From 474f623aaac4bf928130a4f17a65d31f3873af3d Mon Sep 17 00:00:00 2001 From: Michal Toth Date: Fri, 29 Sep 2023 07:13:34 +0000 Subject: [PATCH] LogAuditTests & ArtemisConstants --- .../io/brokerqe/claire/ArtemisConstants.java | 176 ++++++++++ .../java/io/brokerqe/claire/Constants.java | 179 ++--------- .../clients/bundled/ArtemisCommand.java | 1 + .../clients/bundled/BundledArtemisClient.java | 5 +- .../brokerqe/claire/EnvironmentOperator.java | 6 +- .../java/io/brokerqe/claire/KubeClient.java | 2 +- .../claire/OperatorTestDataCollector.java | 4 +- .../io/brokerqe/claire/ResourceManager.java | 2 +- .../claire/monitoring/Prometheus.java | 7 +- .../ArtemisCloudClusterOperatorFile.java | 6 +- .../claire/operator/ArtemisFileProvider.java | 34 +- .../io/brokerqe/claire/security/Keycloak.java | 3 +- .../claire/address/AddressSettingsTests.java | 19 +- .../BrokerConfigurationTests.java | 25 +- .../BrokerCustomResourceStatusTests.java | 29 +- .../claire/logging/ArtemisLoggingTests.java | 31 +- .../claire/monitoring/PrometheusTests.java | 5 +- .../claire/security/KeycloakLdapTests.java | 7 +- .../brokerqe/claire/security/LdapTests.java | 50 +-- .../claire/security/SimpleSecurityTests.java | 3 +- .../security/TLSAuthorizationTests.java | 5 +- .../claire/security/TLSCACertsTests.java | 3 +- .../claire/security/TLSProviderTests.java | 3 +- .../security/TLSSelfSignedCertsTests.java | 3 +- .../claire/webconsole/WebConsoleTests.java | 7 +- .../claire/EnvironmentStandalone.java | 6 +- .../claire/StandaloneTestDataCollector.java | 2 +- .../deployment/BundledClientDeployment.java | 4 +- .../container/AbstractGenericContainer.java | 3 +- .../claire/container/ArtemisContainer.java | 42 ++- .../claire/helper/ArtemisJmxHelper.java | 3 +- .../brokerqe/claire/AbstractSystemTests.java | 35 +- .../replication/FailoverReplicationTests.java | 7 +- .../sharedstore/FailoverSharedStoreTests.java | 13 +- .../helper/webconsole/LoginPageHelper.java | 5 +- .../claire/logging/audit/AuditLogTests.java | 301 ++++++++++++++++++ .../audit/resource/LogAuditResourceTests.java | 57 ---- .../claire/messaging/MessagingTests.java | 5 +- .../claire/messaging/TransactionTests.java | 5 +- .../paging/MaxReadMessagesAndBytesTests.java | 9 +- .../smoke/SingleInstanceSmokeTests.java | 5 +- .../webconsole/SecuredConsoleTests.java | 3 +- .../claire-default-profile-2.21.0.yaml.jinja2 | 19 +- .../claire-default-profile-2.28.0.yaml.jinja2 | 21 +- .../claire-default-profile-2.29.0.yaml.jinja2 | 19 +- .../claire-default-profile-2.30.0.yaml.jinja2 | 19 +- .../claire-default-profile-2.31.0.yaml.jinja2 | 19 +- .../audit/AuditLogTests/tune.yaml.jinja2 | 4 + .../LogAuditResourceTests/tune.yaml.jinja2 | 2 - 49 files changed, 817 insertions(+), 406 deletions(-) create mode 100644 common/src/main/java/io/brokerqe/claire/ArtemisConstants.java create mode 100644 standalone-suite/src/test/java/io/brokerqe/claire/logging/audit/AuditLogTests.java delete mode 100644 standalone-suite/src/test/java/io/brokerqe/claire/logging/audit/resource/LogAuditResourceTests.java create mode 100644 standalone-suite/yacfg_profiles/tests/logging/audit/AuditLogTests/tune.yaml.jinja2 delete mode 100644 standalone-suite/yacfg_profiles/tests/logging/audit/resource/LogAuditResourceTests/tune.yaml.jinja2 diff --git a/common/src/main/java/io/brokerqe/claire/ArtemisConstants.java b/common/src/main/java/io/brokerqe/claire/ArtemisConstants.java new file mode 100644 index 00000000..01d42a1f --- /dev/null +++ b/common/src/main/java/io/brokerqe/claire/ArtemisConstants.java @@ -0,0 +1,176 @@ +/* + * Copyright Strimzi and Broker QE authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package io.brokerqe.claire; + +public interface ArtemisConstants { + // Files + String BIN_DIR = Constants.FILE_SEPARATOR + "bin"; + String ETC_DIR = Constants.FILE_SEPARATOR + "etc"; + String DATA_DIR = Constants.FILE_SEPARATOR + "data"; + String OPT_DIR = Constants.FILE_SEPARATOR + "opt"; + String VAR_DIR = Constants.FILE_SEPARATOR + "var"; + String LIB_DIR = Constants.FILE_SEPARATOR + "lib"; + String LOG_DIR = Constants.FILE_SEPARATOR + "log"; + String TMP_DIR = Constants.FILE_SEPARATOR + "tmp"; + String AUDIT_LOG_FILE = "audit.log"; + String ARTEMIS_LOG_FILE = "artemis.log"; + + + String CONSOLE_STRING = "console"; + String AUTH_STRING = "auth"; + String LOGIN_STRING = "login"; + String WEBCONSOLE_URI_PREFIX = "wconsj"; + + int CONSOLE_PORT = 8161; + int DEFAULT_ALL_PROTOCOLS_PORT = 61616; + int DEFAULT_AMQP_PORT = 5672; + int DEFAULT_HORNETQ_PORT = 5445; + int DEFAULT_JMX_PORT = 1099; + int DEFAULT_MQTT_PORT = 1883; + int DEFAULT_STOMP_PORT = 61613; + int DEFAULT_WEB_CONSOLE_PORT = 8161; + + + + // Logging + String DEFAULT_LOG_LEVEL = "INFO"; + + // Roles + String ROLE_ADMIN = "amq"; + String ROLE_SENDERS = "senders"; + String ROLE_RECEIVERS = "receivers"; + + // Users + String ADMIN_NAME = "admin"; + String ADMIN_PASS = "admin"; + String ALICE_NAME = "alice"; + String ALICE_PASS = "alice"; + String BOB_NAME = "bob"; + String BOB_PASS = "bob"; + String CHARLIE_NAME = "charlie"; + String CHARLIE_PASS = "charlie"; + String LALA_NAME = "lala"; + String LALA_PASS = "lala"; + + // Address/Queue settings + String ROUTING_TYPE_ANYCAST = "anycast"; + String ROUTING_TYPE_MULTICAST = "multicast"; + String ADDRESSSETTINGS_POLICY_DROP = "DROP"; + String ADDRESSSETTINGS_POLICY_FAIL = "FAIL"; + String ADDRESSSETTINGS_POLICY_PAGE = "PAGE"; + String ADDRESSSETTINGS_POLICY_BLOCK = "BLOCK"; + String ADDRESSETTINGS_POLICY_KILL = "KILL"; + String ADDRESSETTINGS_POLICY_NOTIFY = "NOTIFY"; + String ADDRESSSETTING_FORCE = "FORCE"; + String ADDRESSSETTING_OFF = "OFF"; + String ADDRESSSETTINGS_ROUTING_ANYCAST = "ANYCAST"; + String ADDRESSSETTINGS_ROUTING_MULTICAST = "MULTICAST"; + String ADDRESSSETING_UNIT_MPS = "MESSAGES_PER_SECOND"; + + // Artemis test container + String ARTEMIS_STRING = "artemis"; + String INSTANCE_STRING = "artemis-instance"; + String INSTANCE_DIR = "/var/lib/" + INSTANCE_STRING; + String INSTANCE_BIN_DIR = INSTANCE_DIR + "/bin"; + String INSTALL_DIR = "artemis/artemis_install"; + + + // ==== Artemis operator image ==== + // Broker Container folder paths + String CONTAINER_BROKER_HOME_DIR = "/home/jboss/amq-broker/"; + String CONTAINER_BROKER_HOME_ETC_DIR = CONTAINER_BROKER_HOME_DIR + "etc/"; + String CONTAINER_BROKER_HOME_LOG_DIR = CONTAINER_BROKER_HOME_DIR + "log/"; + + // Image + String BROKER_IMAGE_OPERATOR_PREFIX = "RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_"; + String BROKER_INIT_IMAGE_OPERATOR_PREFIX = "RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_"; + String OPERATOR_IMAGE_OPERATOR_PREFIX = "image"; + + + // ArtemisCloud Operator strings + String WATCH_ALL_NAMESPACES = "*"; + String LOGGING_PROPERTIES_CONFIG_KEY = "logging.properties"; + String LOGIN_CONFIG_CONFIG_KEY = "login.config"; + + // Container labels & names + String LABEL_ACTIVEMQARTEMIS = "ActiveMQArtemis"; + + // Condition & Status + String CONDITION_TYPE_BROKER_PROPERTIES_APPLIED = "BrokerPropertiesApplied"; + String CONDITION_TYPE_DEPLOYED = "Deployed"; + String CONDITION_TYPE_READY = "Ready"; + String CONDITION_TYPE_VALID = "Valid"; + String CONDITION_STATUS_READY = "AllPodsReady"; + String CONDITION_REASON_VALIDATION = "ValidationSucceded"; + String CONDITION_REASON_ALL_PODS_READY = "AllPodsReady"; + String CONDITION_REASON_APPLIED = "Applied"; + String CONDITION_REASON_APPLIED_WITH_ERROR = "AppliedWithError"; + String CONDITION_TRUE = "True"; + String CONDITION_FALSE = "False"; + String CONDITION_REASON_OUT_OF_SYNC = "OutOfSync"; + String CONDITION_REASON_INVALID_EXTRA_MOUNT = "InvalidExtraMount"; + String CONDITION_REASON_RESOURCE_ERROR = "ResourceError"; + String CONDITION_REASON_WAITING_FOR_ALL_CONDITIONS = "WaitingForAllConditions"; + + + // New naming style + String INSTALL_ARTEMIS_CO_010_CRD_ARTEMIS_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "crd_artemis.yaml"; + String INSTALL_ARTEMIS_CO_020_CRD_SECURITY_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "crd_artemis_security.yaml"; + String INSTALL_ARTEMIS_CO_030_CRD_ADDRESS_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "crd_artemis_address.yaml"; + String INSTALL_ARTEMIS_CO_040_CRD_SCALEDOWN_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "crd_artemis_scaledown.yaml"; + String INSTALL_ARTEMIS_CO_050_SERVICE_ACCOUNT_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "service_account.yaml"; + String INSTALL_ARTEMIS_CO_060_CLUSTER_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "cluster_role.yaml"; + String INSTALL_ARTEMIS_CO_070_CLUSTER_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "cluster_role_binding.yaml"; + String INSTALL_ARTEMIS_CO_060_NAMESPACE_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "namespace_role.yaml"; + String INSTALL_ARTEMIS_CO_070_NAMESPACE_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "namespace_role_binding.yaml"; + String INSTALL_ARTEMIS_CO_080_ELECTION_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "election_role.yaml"; + String INSTALL_ARTEMIS_CO_090_ELECTION_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "election_role_binding.yaml"; + String INSTALL_ARTEMIS_CO_100_OPERATOR_CONFIG_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "operator_config.yaml"; + String INSTALL_ARTEMIS_CO_110_OPERATOR_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "operator.yaml"; + String EXAMPLE_ADDRESS_QUEUE_PATH = Constants.EXAMPLES_DIR_PATH + "address/address_queue.yaml"; + String EXAMPLE_ADDRESS_TOPIC_PATH = Constants.EXAMPLES_DIR_PATH + "address/address_topic.yaml"; + String EXAMPLE_ARTEMIS_SINGLE_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis_single.yaml"; + String EXAMPLE_ARTEMIS_CLUSTER_PERSISTENCE_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis_cluster_persistence.yaml"; + String EXAMPLE_ARTEMIS_ADDRESS_SETTINGS_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis_address_settings.yaml"; + String EXAMPLE_ARTEMIS_RESOURCES_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis_resources.yaml"; + // Old naming style + String OLD_INSTALL_ARTEMIS_CO_010_CRD_ARTEMIS_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "broker_activemqartemis_crd.yaml"; // 010_crd_artemis.yaml + String OLD_INSTALL_ARTEMIS_CO_020_CRD_SECURITY_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "broker_activemqartemissecurity_crd.yaml"; // 020_crd_artemis_security.yaml + String OLD_INSTALL_ARTEMIS_CO_030_CRD_ADDRESS_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "broker_activemqartemisaddress_crd.yaml"; // 030_crd_artemis_address.yaml + String OLD_INSTALL_ARTEMIS_CO_040_CRD_SCALEDOWN_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "broker_activemqartemisscaledown_crd.yaml"; // 040_crd_artemis_scaledown.yaml + String OLD_INSTALL_ARTEMIS_CO_050_SERVICE_ACCOUNT_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "service_account.yaml"; // 050_service_account.yaml + String OLD_INSTALL_ARTEMIS_CO_060_CLUSTER_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "cluster_role.yaml"; // 060_cluster_role.yaml + String OLD_INSTALL_ARTEMIS_CO_070_CLUSTER_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "cluster_role_binding.yaml"; // 070_cluster_role_binding.yaml + String OLD_INSTALL_ARTEMIS_CO_060_NAMESPACE_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "role.yaml"; // 060_namespace_role.yaml + String OLD_INSTALL_ARTEMIS_CO_070_NAMESPACE_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "role_binding.yaml"; // 070_namespace_role_binding.yaml + String OLD_INSTALL_ARTEMIS_CO_080_ELECTION_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "election_role.yaml"; // 080_election_role.yaml + String OLD_INSTALL_ARTEMIS_CO_090_ELECTION_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "election_role_binding.yaml"; // 090_election_role_binding.yaml + String OLD_INSTALL_ARTEMIS_CO_100_OPERATOR_CONFIG_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "operator_config.yaml"; // 100_operator_config.yaml + String OLD_INSTALL_ARTEMIS_CO_110_OPERATOR_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "operator.yaml"; // 110_operator.yaml + String OLD_EXAMPLE_ADDRESS_QUEUE_PATH = Constants.EXAMPLES_DIR_PATH + "address/address-queue-create.yaml"; + // TODO alternative file does not exist? +// String OLD_EXAMPLE_ADDRESS_TOPIC_PATH = Constants.EXAMPLES_DIR_PATH + "address/address_topic.yaml"; + String OLD_EXAMPLE_ARTEMIS_SINGLE_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis-basic-deployment.yaml"; + + + // Log Strings + String IS_LIVE_LOG_MSG = " INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live"; + String USING_CUSTOM_LOG_MSG = "There is a custom logger configuration defined in JAVA_ARGS_APPEND: -Dlog4j2.configurationFile="; + String USING_DEFAULT_LOG_MSG = "Using default logging configuration(console only)"; + String LOG_PATTERN_FAILED_AUTH_304 = "AMQ601716: User .* failed authentication, reason: 304"; + String LOG_EXCEPTION = "java.lang.Exception"; + String LOG_EXCEPTION_CAUSE = "Caused by: "; + + // Audit Log patterns + String LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN = ".* AMQ601715: User %s\\(%s\\)@.* successfully authenticated"; + String LOG_AUDIT_AUTHENTICATION_FAIL_PRODUCE_PATTERN = ".* AMQ601264: User %s\\(%s\\)@.* gets security check failure, reason = AMQ229032: User: %s does not have permission='SEND' on address %s.*"; + String LOG_AUDIT_AUTHENTICATION_FAIL_CONSUME_PATTERN = ".* AMQ601264: User %s\\(%s\\)@.* gets security check failure, reason = AMQ229213: User: %s does not have permission='CONSUME' for queue %s on address %s.*"; + + String LOG_AUDIT_CREATE_ADDRESS_PATTERN = ".* AMQ601262: User %s\\(%s\\)@.* is creating address on target resource: .* with parameters: \\[%s::%s.*"; + String LOG_AUDIT_CREATE_ADDRESS_PATTERN_AMQP = ".* AMQ601262: User %s\\(%s\\)@.* is creating address on target resource: .* with parameters: .*name=%s.*"; + String LOG_AUDIT_CREATE_QUEUE_PATTERN = ".* AMQ601065: User %s\\(%s\\)@.* is creating a queue on target resource: .* with parameters: \\[.* name=%s, address=%s.*"; + String LOG_AUDIT_SENT_MESSAGE_PATTERN = ".* AMQ601500: User %s\\(%s\\)@.* sent a message .* address=%s::%s.*"; + String LOG_AUDIT_RECEIVED_MESSAGE_PATTERN = ".* AMQ601501: User %s\\(%s\\)@.* is consuming a message from %s.*"; +} diff --git a/common/src/main/java/io/brokerqe/claire/Constants.java b/common/src/main/java/io/brokerqe/claire/Constants.java index d57c55d9..33ded006 100644 --- a/common/src/main/java/io/brokerqe/claire/Constants.java +++ b/common/src/main/java/io/brokerqe/claire/Constants.java @@ -45,56 +45,37 @@ public interface Constants { String EV_USE_EXISTING_CONFIG = "USE_EXISTING_CONFIG"; String PROP_USE_EXISTING_CONFIG = "use.existing.config"; - // Artemis image related - String ARTEMIS_IS_LIVE_LOG_MSG = " INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live"; - String ARTEMIS_USING_CUSTOM_LOG_MSG = "There is a custom logger configuration defined in JAVA_ARGS_APPEND: -Dlog4j2.configurationFile="; - String ARTEMIS_USING_DEFAULT_LOG_MSG = "Using default logging configuration(console only)"; - String ARTEMIS_LOG_EXCEPTION = "java.lang.Exception"; - String ARTEMIS_LOG_EXCEPTION_CAUSE = "Caused by: "; - - String BROKER_IMAGE_OPERATOR_PREFIX = "RELATED_IMAGE_ActiveMQ_Artemis_Broker_Kubernetes_"; - String BROKER_INIT_IMAGE_OPERATOR_PREFIX = "RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_"; - String OPERATOR_IMAGE_OPERATOR_PREFIX = "image"; - - // Artemis Operator strings - String CRD_ACTIVEMQ_ARTEMIS_GROUP = "broker.amq.io"; - String WATCH_ALL_NAMESPACES = "*"; - String LOGGING_PROPERTIES_CONFIG_KEY = "logging.properties"; - String LOGIN_CONFIG_CONFIG_KEY = "login.config"; - - String CONDITION_TYPE_BROKER_PROPERTIES_APPLIED = "BrokerPropertiesApplied"; - String CONDITION_TYPE_DEPLOYED = "Deployed"; - String CONDITION_TYPE_READY = "Ready"; - String CONDITION_TYPE_VALID = "Valid"; - String CONDITION_STATUS_READY = "AllPodsReady"; - String CONDITION_REASON_VALIDATION = "ValidationSucceded"; - String CONDITION_REASON_ALL_PODS_READY = "AllPodsReady"; - String CONDITION_REASON_APPLIED = "Applied"; - String CONDITION_REASON_APPLIED_WITH_ERROR = "AppliedWithError"; - String CONDITION_TRUE = "True"; - String CONDITION_FALSE = "False"; - String CONDITION_REASON_OUT_OF_SYNC = "OutOfSync"; - String CONDITION_REASON_INVALID_EXTRA_MOUNT = "InvalidExtraMount"; - String CONDITION_REASON_RESOURCE_ERROR = "ResourceError"; - String CONDITION_REASON_WAITING_FOR_ALL_CONDITIONS = "WaitingForAllConditions"; - - // Project related strings - String ROUTING_TYPE_ANYCAST = "anycast"; - String ROUTING_TYPE_MULTICAST = "multicast"; String BROKER_KEYSTORE_ID = "broker.ks"; String BROKER_TRUSTSTORE_ID = "broker.ts"; String CLIENT_KEYSTORE_ID = "client.ks"; String CLIENT_TRUSTSTORE_ID = "client.ts"; String KEY_TRUSTSTORE_PASSWORD = "trustStorePassword"; String KEY_KEYSTORE_PASSWORD = "keyStorePassword"; - int CONSOLE_PORT = 8161; - - String WEBCONSOLE_URI_PREFIX = "wconsj"; // Test related strings String DEFAULT_KEYCLOAK_VERSION = "21.0.1"; String DEFAULT_RHSSO_VERSION = "rhsso-operator.7.6.4-opr-002"; + // Networking + String AMQP = "amqp"; + String AMQP_URL_PREFIX = AMQP + "://"; + String HTTP = "http"; + String HTTPS = "https"; + String GET = "GET"; + String POST = "POST"; + + // Timing variables + long DURATION_100_MILLISECONDS = Duration.ofMillis(100).toMillis(); + long DURATION_500_MILLISECONDS = Duration.ofMillis(500).toMillis(); + long DURATION_1_SECOND = Duration.ofSeconds(1).toMillis(); + long DURATION_2_SECONDS = Duration.ofSeconds(2).toMillis(); + long DURATION_5_SECONDS = Duration.ofSeconds(5).toMillis(); + long DURATION_10_SECONDS = Duration.ofSeconds(10).toMillis(); + long DURATION_30_SECONDS = Duration.ofSeconds(30).toMillis(); + long DURATION_1_MINUTE = Duration.ofMinutes(1).toMillis(); + long DURATION_2_MINUTES = Duration.ofMinutes(2).toMillis(); + long DURATION_3_MINUTES = Duration.ofMinutes(3).toMillis(); + long DURATION_5_MINUTES = Duration.ofMinutes(5).toMillis(); // Files String PROJECT_USER_DIR = System.getProperty("user.dir"); String PROJECT_TEST_DIR = PROJECT_USER_DIR + "/src/test/"; @@ -108,20 +89,10 @@ public interface Constants { String VERSION_MAPPER_PATH = PROJECT_USER_DIR + "/../version_map.yaml"; String PERFORMANCE_DIR = PROJECT_USER_DIR + "/../performance/"; - // Standalone - String DEFAULT_LOG_LEVEL = "INFO"; String PROP_LOG_DIR = "log.dir"; String PROP_LOG_LEVEL = "log.level"; String JAVA_HOME = "JAVA_HOME"; String CLAIRE_TEST_PKG_REGEX = ".+\\.claire\\."; - String BIN_DIR = Constants.FILE_SEPARATOR + "bin"; - String ETC_DIR = Constants.FILE_SEPARATOR + "etc"; - String DATA_DIR = Constants.FILE_SEPARATOR + "data"; - String OPT_DIR = Constants.FILE_SEPARATOR + "opt"; - String VAR_DIR = Constants.FILE_SEPARATOR + "var"; - String LIB_DIR = Constants.FILE_SEPARATOR + "lib"; - String LOG_DIR = Constants.FILE_SEPARATOR + "log"; - String TMP_DIR = Constants.FILE_SEPARATOR + "tmp"; String TAR_TMP_FILE_PREFIX = "/container_files_"; String STANDALONE_MODULE_PROPERTIES_FILE = "standalone.properties"; @@ -158,78 +129,24 @@ public interface Constants { String EV_YACFG_ARTEMIS_TEMPLATES_OVERRIDE_DIR = "YACFG_ARTEMIS_TEMPLATES_OVERRIDE_DIR"; String PROP_YACFG_ARTEMIS_TEMPLATES_OVERRIDE_DIR = "yacfg.artemis.templates_override_dir"; - // Artemis - String ARTEMIS_STRING = "artemis"; - String ARTEMIS_INSTANCE_STRING = "artemis-instance"; - String ARTEMIS_INSTALL_DIR = "artemis/artemis_install"; String ARTEMIS_DEFAULT_CFG_DIR = "artemis/artemis_default_cfg"; String ARTEMIS_TEST_CFG_DIR = "test_cfg"; - String ARTEMIS_DEFAULT_CFG_BIN_DIR = ARTEMIS_DEFAULT_CFG_DIR + FILE_SEPARATOR + BIN_DIR; - String ARTEMIS_DEFAULT_CFG_LIB_DIR = ARTEMIS_DEFAULT_CFG_DIR + FILE_SEPARATOR + LIB_DIR; - String ARTEMIS_INSTANCE_USER_NAME = "admin"; - String ARTEMIS_INSTANCE_USER_PASS = "admin"; - String ARTEMIS_INSTANCE_DIR = "/var/lib/" + ARTEMIS_INSTANCE_STRING; - String ARTEMIS_INSTANCE_BIN_DIR = ARTEMIS_INSTANCE_DIR + "/bin"; - String CONSOLE_STRING = "console"; - String AUTH_STRING = "auth"; - String LOGIN_STRING = "login"; - - // New naming style - String INSTALL_ARTEMIS_CO_010_CRD_ARTEMIS_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "crd_artemis.yaml"; - String INSTALL_ARTEMIS_CO_020_CRD_SECURITY_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "crd_artemis_security.yaml"; - String INSTALL_ARTEMIS_CO_030_CRD_ADDRESS_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "crd_artemis_address.yaml"; - String INSTALL_ARTEMIS_CO_040_CRD_SCALEDOWN_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "crd_artemis_scaledown.yaml"; - String INSTALL_ARTEMIS_CO_050_SERVICE_ACCOUNT_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "service_account.yaml"; - String INSTALL_ARTEMIS_CO_060_CLUSTER_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "cluster_role.yaml"; - String INSTALL_ARTEMIS_CO_070_CLUSTER_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "cluster_role_binding.yaml"; - String INSTALL_ARTEMIS_CO_060_NAMESPACE_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "namespace_role.yaml"; - String INSTALL_ARTEMIS_CO_070_NAMESPACE_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "namespace_role_binding.yaml"; - String INSTALL_ARTEMIS_CO_080_ELECTION_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "election_role.yaml"; - String INSTALL_ARTEMIS_CO_090_ELECTION_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "election_role_binding.yaml"; - String INSTALL_ARTEMIS_CO_100_OPERATOR_CONFIG_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "operator_config.yaml"; - String INSTALL_ARTEMIS_CO_110_OPERATOR_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "operator.yaml"; - - String EXAMPLE_ADDRESS_QUEUE_PATH = Constants.EXAMPLES_DIR_PATH + "address/address_queue.yaml"; - String EXAMPLE_ADDRESS_TOPIC_PATH = Constants.EXAMPLES_DIR_PATH + "address/address_topic.yaml"; - String EXAMPLE_ARTEMIS_SINGLE_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis_single.yaml"; - String EXAMPLE_ARTEMIS_CLUSTER_PERSISTENCE_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis_cluster_persistence.yaml"; - String EXAMPLE_ARTEMIS_ADDRESS_SETTINGS_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis_address_settings.yaml"; - String EXAMPLE_ARTEMIS_RESOURCES_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis_resources.yaml"; - - // Old naming style - String OLD_INSTALL_ARTEMIS_CO_010_CRD_ARTEMIS_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "broker_activemqartemis_crd.yaml"; // 010_crd_artemis.yaml - String OLD_INSTALL_ARTEMIS_CO_020_CRD_SECURITY_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "broker_activemqartemissecurity_crd.yaml"; // 020_crd_artemis_security.yaml - String OLD_INSTALL_ARTEMIS_CO_030_CRD_ADDRESS_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "broker_activemqartemisaddress_crd.yaml"; // 030_crd_artemis_address.yaml - String OLD_INSTALL_ARTEMIS_CO_040_CRD_SCALEDOWN_PATH = Constants.OPERATOR_CRDS_DIR_PATH + "broker_activemqartemisscaledown_crd.yaml"; // 040_crd_artemis_scaledown.yaml - String OLD_INSTALL_ARTEMIS_CO_050_SERVICE_ACCOUNT_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "service_account.yaml"; // 050_service_account.yaml - String OLD_INSTALL_ARTEMIS_CO_060_CLUSTER_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "cluster_role.yaml"; // 060_cluster_role.yaml - String OLD_INSTALL_ARTEMIS_CO_070_CLUSTER_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "cluster_role_binding.yaml"; // 070_cluster_role_binding.yaml - String OLD_INSTALL_ARTEMIS_CO_060_NAMESPACE_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "role.yaml"; // 060_namespace_role.yaml - String OLD_INSTALL_ARTEMIS_CO_070_NAMESPACE_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "role_binding.yaml"; // 070_namespace_role_binding.yaml - String OLD_INSTALL_ARTEMIS_CO_080_ELECTION_ROLE_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "election_role.yaml"; // 080_election_role.yaml - String OLD_INSTALL_ARTEMIS_CO_090_ELECTION_ROLE_BINDING_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "election_role_binding.yaml"; // 090_election_role_binding.yaml - String OLD_INSTALL_ARTEMIS_CO_100_OPERATOR_CONFIG_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "operator_config.yaml"; // 100_operator_config.yaml - String OLD_INSTALL_ARTEMIS_CO_110_OPERATOR_PATH = Constants.OPERATOR_INSTALL_DIR_PATH + "operator.yaml"; // 110_operator.yaml - - String OLD_EXAMPLE_ADDRESS_QUEUE_PATH = Constants.EXAMPLES_DIR_PATH + "address/address-queue-create.yaml"; - // TODO alternative file does not exist? -// String OLD_EXAMPLE_ADDRESS_TOPIC_PATH = Constants.EXAMPLES_DIR_PATH + "address/address_topic.yaml"; - String OLD_EXAMPLE_ARTEMIS_SINGLE_PATH = Constants.EXAMPLES_DIR_PATH + "artemis/artemis-basic-deployment.yaml"; - - // Container labels & names - String LABEL_ACTIVEMQARTEMIS = "ActiveMQArtemis"; + String ARTEMIS_DEFAULT_CFG_BIN_DIR = ARTEMIS_DEFAULT_CFG_DIR + FILE_SEPARATOR + ArtemisConstants.BIN_DIR; + String ARTEMIS_DEFAULT_CFG_LIB_DIR = ARTEMIS_DEFAULT_CFG_DIR + FILE_SEPARATOR + ArtemisConstants.LIB_DIR; String PREFIX_SYSTEMTESTS_CLIENTS = "systemtests-clients"; - String IMAGE_SYSTEMTEST_CLIENTS = "quay.io/rhmessagingqe/cli-java:latest"; String PREFIX_SYSTEMTESTS_CLI_PROTON_DOTNET = "systemtests-cli-proton-dotnet"; - String IMAGE_SYSTEMTEST_CLI_PROTON_DOTNET = "quay.io/messaging/cli-proton-dotnet:latest"; String PREFIX_SYSTEMTESTS_CLI_CPP = "systemtests-cli-cpp"; - String IMAGE_SYSTEMTEST_CLI_CPP = "quay.io/messaging/cli-cpp:latest"; String PREFIX_SYSTEMTESTS_CLI_PROTON_PYTHON = "systemtests-cli-proton-python"; - String IMAGE_SYSTEMTEST_CLI_PROTON_PYTHON = "quay.io/messaging/cli-proton-python:latest"; String PREFIX_SYSTEMTESTS_CLI_RHEA = "systemtests-cli-rhea"; - String IMAGE_SYSTEMTEST_CLI_RHEA = "quay.io/messaging/cli-rhea:latest"; String PREFIX_MQTT_CLIENT = "mqtt-client"; + + // Images + String IMAGE_SYSTEMTEST_CLIENTS = "quay.io/rhmessagingqe/cli-java:latest"; + String IMAGE_SYSTEMTEST_CLI_PROTON_DOTNET = "quay.io/messaging/cli-proton-dotnet:latest"; + String IMAGE_SYSTEMTEST_CLI_CPP = "quay.io/messaging/cli-cpp:latest"; + String IMAGE_SYSTEMTEST_CLI_PROTON_PYTHON = "quay.io/messaging/cli-proton-python:latest"; + String IMAGE_SYSTEMTEST_CLI_RHEA = "quay.io/messaging/cli-rhea:latest"; String IMAGE_MQTT_CLIENT = "quay.io/rhmessagingqe/hivemq-mqtt-cli"; // String IMAGE_OPENLDAP = "docker.io/bitnami/openldap:latest"; String IMAGE_OPENLDAP = "docker.io/bitnami/openldap:2.6.3"; @@ -240,38 +157,12 @@ public interface Constants { String IMAGE_MSSQL = "mcr.microsoft.com/mssql/server:2022-latest"; String IMAGE_ORACLE = "container-registry.oracle.com/database/free:latest"; - // Container folder paths - String CONTAINER_BROKER_HOME_DIR = "/home/jboss/amq-broker/"; - String CONTAINER_BROKER_HOME_ETC_DIR = CONTAINER_BROKER_HOME_DIR + "etc/"; - String CONTAINER_BROKER_HOME_LOG_DIR = CONTAINER_BROKER_HOME_DIR + "log/"; - - // Timing variables - long DURATION_100_MILLISECONDS = Duration.ofMillis(100).toMillis(); - long DURATION_500_MILLISECONDS = Duration.ofMillis(500).toMillis(); - long DURATION_1_SECOND = Duration.ofSeconds(1).toMillis(); - long DURATION_2_SECONDS = Duration.ofSeconds(2).toMillis(); - long DURATION_5_SECONDS = Duration.ofSeconds(5).toMillis(); - long DURATION_10_SECONDS = Duration.ofSeconds(10).toMillis(); - long DURATION_30_SECONDS = Duration.ofSeconds(30).toMillis(); - long DURATION_1_MINUTE = Duration.ofMinutes(1).toMillis(); - long DURATION_2_MINUTES = Duration.ofMinutes(2).toMillis(); - long DURATION_3_MINUTES = Duration.ofMinutes(3).toMillis(); - long DURATION_5_MINUTES = Duration.ofMinutes(5).toMillis(); - // Openshift related String MONITORING_NAMESPACE = "openshift-monitoring"; String MONITORING_NAMESPACE_USER = "openshift-user-workload-monitoring"; String PROMETHEUS_USER_SS = "prometheus-user-workload"; String THANOS_USER_SS = "thanos-ruler-user-workload"; - // Networking - String AMQP = "amqp"; - String AMQP_URL_PREFIX = AMQP + "://"; - String HTTP = "http"; - String HTTPS = "https"; - String GET = "GET"; - String POST = "POST"; - // Database String POSTGRESQL_DRIVER_URL = "https://jdbc.postgresql.org/download/postgresql-42.6.0.jar"; String MYSQL_DRIVER_URL = "https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.30/mysql-connector-java-8.0.30.jar"; @@ -279,16 +170,4 @@ public interface Constants { String MSSQL_DRIVER_URL = "https://download.microsoft.com/download/a/9/1/a91534b0-ed8c-4501-b491-e1dd0a20335a/sqljdbc_12.2.0.0_enu.zip"; String ORACLE_DRIVER_URL = "https://download.oracle.com/otn-pub/otn_software/jdbc/2110/ojdbc11.jar"; - String ADDRESSSETTINGS_POLICY_DROP = "DROP"; - String ADDRESSSETTINGS_POLICY_FAIL = "FAIL"; - String ADDRESSSETTINGS_POLICY_PAGE = "PAGE"; - String ADDRESSSETTINGS_POLICY_BLOCK = "BLOCK"; - String ADDRESSETTINGS_POLICY_KILL = "KILL"; - String ADDRESSETTINGS_POLICY_NOTIFY = "NOTIFY"; - String ADDRESSSETTING_FORCE = "FORCE"; - String ADDRESSSETTING_OFF = "OFF"; - String ADDRESSSETTINGS_ROUTING_ANYCAST = "ANYCAST"; - String ADDRESSSETTINGS_ROUTING_MULTICAST = "MULTICAST"; - String ADDRESSSETING_UNIT_MPS = "MESSAGES_PER_SECOND"; - } diff --git a/common/src/main/java/io/brokerqe/claire/clients/bundled/ArtemisCommand.java b/common/src/main/java/io/brokerqe/claire/clients/bundled/ArtemisCommand.java index 6d5f7eb4..34fbd758 100644 --- a/common/src/main/java/io/brokerqe/claire/clients/bundled/ArtemisCommand.java +++ b/common/src/main/java/io/brokerqe/claire/clients/bundled/ArtemisCommand.java @@ -7,6 +7,7 @@ public enum ArtemisCommand { ADDRESS_SHOW("address show"), ADDRESS_CREATE("address create"), + ADDRESS_DELETE("address delete"), QUEUE_CREATE("queue create"), QUEUE_DELETE("queue delete"), QUEUE_STAT("queue stat"), diff --git a/common/src/main/java/io/brokerqe/claire/clients/bundled/BundledArtemisClient.java b/common/src/main/java/io/brokerqe/claire/clients/bundled/BundledArtemisClient.java index 4718c720..4bd540d4 100644 --- a/common/src/main/java/io/brokerqe/claire/clients/bundled/BundledArtemisClient.java +++ b/common/src/main/java/io/brokerqe/claire/clients/bundled/BundledArtemisClient.java @@ -4,6 +4,7 @@ */ package io.brokerqe.claire.clients.bundled; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.clients.DeployableClient; import org.slf4j.Logger; @@ -26,11 +27,11 @@ public class BundledArtemisClient { private String destination; public BundledArtemisClient(DeployableClient deployableClient, ArtemisCommand artemisCommand, Map commandOptions) { - this(deployableClient, artemisCommand, Constants.ARTEMIS_INSTANCE_USER_NAME, Constants.ARTEMIS_INSTANCE_USER_PASS, commandOptions); + this(deployableClient, artemisCommand, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ADMIN_PASS, commandOptions); } public BundledArtemisClient(DeployableClient deployableClient, ArtemisCommand artemisCommand, Map commandOptions, String destination) { - this(deployableClient, artemisCommand, Constants.ARTEMIS_INSTANCE_USER_NAME, Constants.ARTEMIS_INSTANCE_USER_PASS, commandOptions); + this(deployableClient, artemisCommand, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ADMIN_PASS, commandOptions); this.destination = destination; } diff --git a/operator-suite/src/main/java/io/brokerqe/claire/EnvironmentOperator.java b/operator-suite/src/main/java/io/brokerqe/claire/EnvironmentOperator.java index 5282ecd0..f5e7ad5b 100644 --- a/operator-suite/src/main/java/io/brokerqe/claire/EnvironmentOperator.java +++ b/operator-suite/src/main/java/io/brokerqe/claire/EnvironmentOperator.java @@ -203,17 +203,17 @@ private void checkSetProvidedImages() { if (brokerImage != null && !brokerImage.equals("")) { LOGGER.debug("[ENV] Updating {} with {}", operatorFile, brokerImage); - ArtemisCloudClusterOperatorFile.updateImagesInOperatorFile(operatorFile, Constants.BROKER_IMAGE_OPERATOR_PREFIX, brokerImage, artemisVersion); + ArtemisCloudClusterOperatorFile.updateImagesInOperatorFile(operatorFile, ArtemisConstants.BROKER_IMAGE_OPERATOR_PREFIX, brokerImage, artemisVersion); } if (brokerInitImage != null && !brokerInitImage.equals("")) { LOGGER.debug("[ENV] Updating {} with {}", operatorFile, brokerInitImage); - ArtemisCloudClusterOperatorFile.updateImagesInOperatorFile(operatorFile, Constants.BROKER_INIT_IMAGE_OPERATOR_PREFIX, brokerInitImage, artemisVersion); + ArtemisCloudClusterOperatorFile.updateImagesInOperatorFile(operatorFile, ArtemisConstants.BROKER_INIT_IMAGE_OPERATOR_PREFIX, brokerInitImage, artemisVersion); } if (operatorImage != null && !operatorImage.equals("")) { LOGGER.debug("[ENV] Updating {} with {}", operatorFile, operatorImage); - ArtemisCloudClusterOperatorFile.updateImagesInOperatorFile(operatorFile, Constants.OPERATOR_IMAGE_OPERATOR_PREFIX, operatorImage, null); + ArtemisCloudClusterOperatorFile.updateImagesInOperatorFile(operatorFile, ArtemisConstants.OPERATOR_IMAGE_OPERATOR_PREFIX, operatorImage, null); } } diff --git a/operator-suite/src/main/java/io/brokerqe/claire/KubeClient.java b/operator-suite/src/main/java/io/brokerqe/claire/KubeClient.java index def10e0f..5e89de61 100644 --- a/operator-suite/src/main/java/io/brokerqe/claire/KubeClient.java +++ b/operator-suite/src/main/java/io/brokerqe/claire/KubeClient.java @@ -206,7 +206,7 @@ public Pod getArtemisPodByLabel(String namespace) { for (Pod pod : pods) { Map labels = pod.getMetadata().getLabels(); for (String key : labels.keySet()) { - if (key.equals(Constants.LABEL_ACTIVEMQARTEMIS)) { + if (key.equals(ArtemisConstants.LABEL_ACTIVEMQARTEMIS)) { StatefulSet ss = getDefaultArtemisStatefulSet(labels.get(key)); if (ss != null) { foundPod = pod; diff --git a/operator-suite/src/main/java/io/brokerqe/claire/OperatorTestDataCollector.java b/operator-suite/src/main/java/io/brokerqe/claire/OperatorTestDataCollector.java index 64842526..01f4f7d6 100644 --- a/operator-suite/src/main/java/io/brokerqe/claire/OperatorTestDataCollector.java +++ b/operator-suite/src/main/java/io/brokerqe/claire/OperatorTestDataCollector.java @@ -89,9 +89,9 @@ protected void collectTestData() { private void collectBrokerPodFiles(List pods, String archiveLocation) { List fileList = List.of("artemis-roles.properties", "artemis.profile", "broker.xml", "jolokia-access.xml", "login.config", "artemis-users.properties", "bootstrap.xml", "jgroups-ping.xml", "logging.properties", "management.xml"); - final String amqBrokerEtcHome = Constants.CONTAINER_BROKER_HOME_ETC_DIR; + final String amqBrokerEtcHome = ArtemisConstants.CONTAINER_BROKER_HOME_ETC_DIR; for (Pod pod : pods) { - if (pod.getMetadata().getLabels().containsKey(Constants.LABEL_ACTIVEMQARTEMIS)) { + if (pod.getMetadata().getLabels().containsKey(ArtemisConstants.LABEL_ACTIVEMQARTEMIS)) { String dirName = archiveLocation + Constants.FILE_SEPARATOR + "broker_etc" + Constants.FILE_SEPARATOR + pod.getMetadata().getName(); TestUtils.createDirectory(dirName); diff --git a/operator-suite/src/main/java/io/brokerqe/claire/ResourceManager.java b/operator-suite/src/main/java/io/brokerqe/claire/ResourceManager.java index 9149c27a..7502d9f3 100644 --- a/operator-suite/src/main/java/io/brokerqe/claire/ResourceManager.java +++ b/operator-suite/src/main/java/io/brokerqe/claire/ResourceManager.java @@ -310,7 +310,7 @@ public static ActiveMQArtemisAddress createArtemisAddress(String namespace, Path } public static ActiveMQArtemisAddress createArtemisAddress(String namespace, String addressName, String queueName) { - return createArtemisAddress(namespace, addressName, queueName, Constants.ROUTING_TYPE_ANYCAST); + return createArtemisAddress(namespace, addressName, queueName, ArtemisConstants.ROUTING_TYPE_ANYCAST); } public static ActiveMQArtemisAddress createArtemisAddress(String namespace, String addressName, String queueName, String routingType) { diff --git a/operator-suite/src/main/java/io/brokerqe/claire/monitoring/Prometheus.java b/operator-suite/src/main/java/io/brokerqe/claire/monitoring/Prometheus.java index 0ccca5fc..2f0b6488 100644 --- a/operator-suite/src/main/java/io/brokerqe/claire/monitoring/Prometheus.java +++ b/operator-suite/src/main/java/io/brokerqe/claire/monitoring/Prometheus.java @@ -5,6 +5,7 @@ package io.brokerqe.claire.monitoring; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.KubeClient; @@ -80,9 +81,9 @@ public void enablePrometheusUserMonitoring() { public void createServiceMonitor(String applicationName) { ArtemisVersion artemisVersion = ResourceManager.getEnvironment().getArtemisTestVersion(); - String webConsolePort = Constants.WEBCONSOLE_URI_PREFIX; + String webConsolePort = ArtemisConstants.WEBCONSOLE_URI_PREFIX; if (artemisVersion.getVersionNumber() < ArtemisVersion.VERSION_2_28.getVersionNumber()) { - webConsolePort = Constants.WEBCONSOLE_URI_PREFIX + "-0"; + webConsolePort = ArtemisConstants.WEBCONSOLE_URI_PREFIX + "-0"; } ServiceMonitor serviceMonitor = new ServiceMonitorBuilder() @@ -129,7 +130,7 @@ public String getMetricsUrl(String brokerName) { } public String getMetricsUrl(int podIndex, String brokerName) { - return Constants.HTTP + "://" + kubeClient.getExternalAccessServiceUrlPrefixName(namespace, brokerName + "-" + Constants.WEBCONSOLE_URI_PREFIX + "-").get(podIndex) + "/metrics/"; + return Constants.HTTP + "://" + kubeClient.getExternalAccessServiceUrlPrefixName(namespace, brokerName + "-" + ArtemisConstants.WEBCONSOLE_URI_PREFIX + "-").get(podIndex) + "/metrics/"; } public void disablePrometheusUserMonitoring() { diff --git a/operator-suite/src/main/java/io/brokerqe/claire/operator/ArtemisCloudClusterOperatorFile.java b/operator-suite/src/main/java/io/brokerqe/claire/operator/ArtemisCloudClusterOperatorFile.java index 8eb280cf..0ef1ba9d 100644 --- a/operator-suite/src/main/java/io/brokerqe/claire/operator/ArtemisCloudClusterOperatorFile.java +++ b/operator-suite/src/main/java/io/brokerqe/claire/operator/ArtemisCloudClusterOperatorFile.java @@ -4,7 +4,7 @@ */ package io.brokerqe.claire.operator; -import io.brokerqe.claire.Constants; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ResourceManager; import io.brokerqe.claire.TestUtils; import io.fabric8.kubernetes.api.model.EnvVar; @@ -234,11 +234,11 @@ public static void updateImagesInOperatorFile(Path operatorFile, String imageTyp } Deployment operator = TestUtils.configFromYaml(operatorFile.toFile(), Deployment.class); - if (imageType.equals(Constants.OPERATOR_IMAGE_OPERATOR_PREFIX)) { + if (imageType.equals(ArtemisConstants.OPERATOR_IMAGE_OPERATOR_PREFIX)) { operator.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageUrl); } - if (imageType.equals(Constants.BROKER_IMAGE_OPERATOR_PREFIX) || imageType.equals(Constants.BROKER_INIT_IMAGE_OPERATOR_PREFIX)) { + if (imageType.equals(ArtemisConstants.BROKER_IMAGE_OPERATOR_PREFIX) || imageType.equals(ArtemisConstants.BROKER_INIT_IMAGE_OPERATOR_PREFIX)) { envVars = operator.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv(); String finalImageTypeVersion = imageTypeVersion; EnvVar brokerImageEV = envVars.stream().filter(envVar -> envVar.getName().equals(finalImageTypeVersion)).findFirst().get(); diff --git a/operator-suite/src/main/java/io/brokerqe/claire/operator/ArtemisFileProvider.java b/operator-suite/src/main/java/io/brokerqe/claire/operator/ArtemisFileProvider.java index 53659eb8..04eb5ca7 100644 --- a/operator-suite/src/main/java/io/brokerqe/claire/operator/ArtemisFileProvider.java +++ b/operator-suite/src/main/java/io/brokerqe/claire/operator/ArtemisFileProvider.java @@ -4,7 +4,7 @@ */ package io.brokerqe.claire.operator; -import io.brokerqe.claire.Constants; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.EnvironmentOperator; import io.brokerqe.claire.exception.ClaireRuntimeException; import org.slf4j.Logger; @@ -19,69 +19,69 @@ public class ArtemisFileProvider { static final Logger LOGGER = LoggerFactory.getLogger(EnvironmentOperator.class); public static Path getArtemisCrdFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_010_CRD_ARTEMIS_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_010_CRD_ARTEMIS_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_010_CRD_ARTEMIS_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_010_CRD_ARTEMIS_PATH); } public static Path getSecurityCrdFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_020_CRD_SECURITY_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_020_CRD_SECURITY_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_020_CRD_SECURITY_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_020_CRD_SECURITY_PATH); } public static Path getAddressCrdFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_030_CRD_ADDRESS_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_030_CRD_ADDRESS_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_030_CRD_ADDRESS_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_030_CRD_ADDRESS_PATH); } public static Path getScaledownCrdFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_040_CRD_SCALEDOWN_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_040_CRD_SCALEDOWN_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_040_CRD_SCALEDOWN_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_040_CRD_SCALEDOWN_PATH); } public static Path getServiceAccountInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_050_SERVICE_ACCOUNT_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_050_SERVICE_ACCOUNT_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_050_SERVICE_ACCOUNT_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_050_SERVICE_ACCOUNT_PATH); } public static Path getClusterRoleInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_060_CLUSTER_ROLE_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_060_CLUSTER_ROLE_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_060_CLUSTER_ROLE_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_060_CLUSTER_ROLE_PATH); } public static Path getClusterRoleBindingInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_070_CLUSTER_ROLE_BINDING_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_070_CLUSTER_ROLE_BINDING_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_070_CLUSTER_ROLE_BINDING_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_070_CLUSTER_ROLE_BINDING_PATH); } public static Path getNamespaceRoleInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_060_NAMESPACE_ROLE_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_060_NAMESPACE_ROLE_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_060_NAMESPACE_ROLE_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_060_NAMESPACE_ROLE_PATH); } public static Path getNamespaceRoleBindingInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_070_NAMESPACE_ROLE_BINDING_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_070_NAMESPACE_ROLE_BINDING_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_070_NAMESPACE_ROLE_BINDING_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_070_NAMESPACE_ROLE_BINDING_PATH); } public static Path getElectionRoleInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_080_ELECTION_ROLE_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_080_ELECTION_ROLE_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_080_ELECTION_ROLE_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_080_ELECTION_ROLE_PATH); } public static Path getElectionRoleBindingInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_090_ELECTION_ROLE_BINDING_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_090_ELECTION_ROLE_BINDING_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_090_ELECTION_ROLE_BINDING_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_090_ELECTION_ROLE_BINDING_PATH); } public static Path getOperatorConfigInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_100_OPERATOR_CONFIG_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_100_OPERATOR_CONFIG_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_100_OPERATOR_CONFIG_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_100_OPERATOR_CONFIG_PATH); } public static Path getOperatorInstallFile() { - return getPresentFile(Constants.INSTALL_ARTEMIS_CO_110_OPERATOR_PATH, Constants.OLD_INSTALL_ARTEMIS_CO_110_OPERATOR_PATH); + return getPresentFile(ArtemisConstants.INSTALL_ARTEMIS_CO_110_OPERATOR_PATH, ArtemisConstants.OLD_INSTALL_ARTEMIS_CO_110_OPERATOR_PATH); } // Examples public static Path getArtemisSingleExampleFile() { - return getPresentFile(Constants.EXAMPLE_ARTEMIS_SINGLE_PATH, Constants.OLD_EXAMPLE_ARTEMIS_SINGLE_PATH); + return getPresentFile(ArtemisConstants.EXAMPLE_ARTEMIS_SINGLE_PATH, ArtemisConstants.OLD_EXAMPLE_ARTEMIS_SINGLE_PATH); } public static Path getAddressQueueExampleFile() { - return getPresentFile(Constants.EXAMPLE_ADDRESS_QUEUE_PATH, Constants.OLD_EXAMPLE_ADDRESS_QUEUE_PATH); + return getPresentFile(ArtemisConstants.EXAMPLE_ADDRESS_QUEUE_PATH, ArtemisConstants.OLD_EXAMPLE_ADDRESS_QUEUE_PATH); } public static Path getAddressTopicExampleFile() { // TODO match here something newer instead of null? - return getPresentFile(Constants.EXAMPLE_ADDRESS_TOPIC_PATH, null); + return getPresentFile(ArtemisConstants.EXAMPLE_ADDRESS_TOPIC_PATH, null); } private static Path getPresentFile(String newStyleFile, String oldStyleFile) { diff --git a/operator-suite/src/main/java/io/brokerqe/claire/security/Keycloak.java b/operator-suite/src/main/java/io/brokerqe/claire/security/Keycloak.java index ff45a248..8a42d52f 100644 --- a/operator-suite/src/main/java/io/brokerqe/claire/security/Keycloak.java +++ b/operator-suite/src/main/java/io/brokerqe/claire/security/Keycloak.java @@ -5,6 +5,7 @@ package io.brokerqe.claire.security; import io.amq.broker.v1beta1.ActiveMQArtemis; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.EnvironmentOperator; import io.brokerqe.claire.KubeClient; @@ -289,7 +290,7 @@ public void setupRedirectUris(String realm, String clientName, ActiveMQArtemis b String clientId = getClientId(realm, clientName); LOGGER.debug("[{}] [KC] Update redirectUris in realm {} {}", namespace, realm, clientName); List uris = kubeClient.getExternalAccessServiceUrlPrefixName( - namespace, broker.getMetadata().getName() + "-" + Constants.WEBCONSOLE_URI_PREFIX + "-"); + namespace, broker.getMetadata().getName() + "-" + ArtemisConstants.WEBCONSOLE_URI_PREFIX + "-"); String format = broker.getSpec().getConsole().getSslEnabled() ? "https://ROUTE/console/*" : "http://ROUTE/console/*"; StringBuilder constructRoutes = new StringBuilder(); diff --git a/operator-suite/src/test/java/io/brokerqe/claire/address/AddressSettingsTests.java b/operator-suite/src/test/java/io/brokerqe/claire/address/AddressSettingsTests.java index d5da3f4a..12efd685 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/address/AddressSettingsTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/address/AddressSettingsTests.java @@ -10,6 +10,7 @@ import io.amq.broker.v1beta1.ActiveMQArtemisBuilder; import io.amq.broker.v1beta1.activemqartemisspec.addresssettings.AddressSetting; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; import io.brokerqe.claire.helpers.JolokiaHelper; @@ -105,7 +106,7 @@ private AddressSetting getDefaultAddressSetting(String match) { AddressSetting setting = new AddressSetting(); setting.setAutoDeleteAddresses(true); setting.setAutoCreateAddresses(true); - setting.setAddressFullPolicy(Constants.ADDRESSSETTINGS_POLICY_DROP); + setting.setAddressFullPolicy(ArtemisConstants.ADDRESSSETTINGS_POLICY_DROP); setting.setAutoCreateDeadLetterResources(true); setting.setAutoCreateExpiryResources(true); setting.setAutoCreateJmsQueues(true); @@ -123,13 +124,13 @@ private AddressSetting getDefaultAddressSetting(String match) { setting.setAutoCreateJmsQueues(true); setting.setAutoCreateExpiryResources(true); setting.setAutoCreateDeadLetterResources(true); - setting.setConfigDeleteAddresses(Constants.ADDRESSSETTING_FORCE); - setting.setConfigDeleteDiverts(Constants.ADDRESSSETTING_FORCE); - setting.setConfigDeleteQueues(Constants.ADDRESSSETTING_FORCE); + setting.setConfigDeleteAddresses(ArtemisConstants.ADDRESSSETTING_FORCE); + setting.setConfigDeleteDiverts(ArtemisConstants.ADDRESSSETTING_FORCE); + setting.setConfigDeleteQueues(ArtemisConstants.ADDRESSSETTING_FORCE); setting.setDeadLetterAddress("deadlq"); setting.setDeadLetterQueuePrefix("deadlq"); setting.setDeadLetterQueueSuffix("deadlq"); - setting.setDefaultAddressRoutingType(Constants.ADDRESSSETTINGS_ROUTING_MULTICAST); + setting.setDefaultAddressRoutingType(ArtemisConstants.ADDRESSSETTINGS_ROUTING_MULTICAST); setting.setDefaultConsumersBeforeDispatch(100); setting.setDefaultConsumerWindowSize(100); setting.setDefaultGroupBuckets(100); @@ -143,7 +144,7 @@ private AddressSetting getDefaultAddressSetting(String match) { setting.setDefaultMaxConsumers(100); setting.setDefaultNonDestructive(true); setting.setDefaultPurgeOnNoConsumers(true); - setting.setDefaultQueueRoutingType(Constants.ADDRESSSETTINGS_ROUTING_MULTICAST); + setting.setDefaultQueueRoutingType(ArtemisConstants.ADDRESSSETTINGS_ROUTING_MULTICAST); setting.setDefaultRingSize(100); /* * This parameter is bugged starting 7.10.0 @@ -173,9 +174,9 @@ private AddressSetting getDefaultAddressSetting(String match) { setting.setRetroactiveMessageCount(100); setting.setSendToDlaOnNoRoute(true); setting.setSlowConsumerCheckPeriod(100); - setting.setSlowConsumerPolicy(Constants.ADDRESSETTINGS_POLICY_NOTIFY); + setting.setSlowConsumerPolicy(ArtemisConstants.ADDRESSETTINGS_POLICY_NOTIFY); setting.setSlowConsumerThreshold(100); - setting.setSlowConsumerThresholdMeasurementUnit(Constants.ADDRESSSETING_UNIT_MPS); + setting.setSlowConsumerThresholdMeasurementUnit(ArtemisConstants.ADDRESSSETING_UNIT_MPS); setting.setMatch(match); return setting; @@ -208,7 +209,7 @@ void basicAddressSettingsTest() throws IOException { ResourceManager.createArtemis(testNamespace, broker); String brokerName = broker.getMetadata().getName(); - String response = JolokiaHelper.getAddressSettings(getClient().getExternalAccessServiceUrl(testNamespace, brokerName + "-" + Constants.WEBCONSOLE_URI_PREFIX + "-0-svc-rte"), "someQueue"); + String response = JolokiaHelper.getAddressSettings(getClient().getExternalAccessServiceUrl(testNamespace, brokerName + "-" + ArtemisConstants.WEBCONSOLE_URI_PREFIX + "-0-svc-rte"), "someQueue"); LOGGER.trace("Content: " + response); JSONObject jsonResponse = new JSONObject(response); JSONObject jsonValue = new JSONObject(jsonResponse.getString("value").replace("\\", "")); diff --git a/operator-suite/src/test/java/io/brokerqe/claire/configuration/BrokerConfigurationTests.java b/operator-suite/src/test/java/io/brokerqe/claire/configuration/BrokerConfigurationTests.java index 7983f025..70a63b8a 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/configuration/BrokerConfigurationTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/configuration/BrokerConfigurationTests.java @@ -11,6 +11,7 @@ import io.amq.broker.v1beta1.activemqartemisspec.Env; import io.amq.broker.v1beta1.activemqartemisspec.deploymentplan.Resources; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.KubeClient; @@ -148,11 +149,11 @@ void verifyStatefulSetContainerPort() { List amqPorts = amqss.getSpec().getTemplate().getSpec().getContainers().get(0).getPorts(); Assertions.assertThat(amqPorts) .extracting(ContainerPort::getName) - .containsExactly(Constants.WEBCONSOLE_URI_PREFIX); + .containsExactly(ArtemisConstants.WEBCONSOLE_URI_PREFIX); Assertions.assertThat(amqPorts) - .filteredOn("name", Constants.WEBCONSOLE_URI_PREFIX) + .filteredOn("name", ArtemisConstants.WEBCONSOLE_URI_PREFIX) .extracting(ContainerPort::getContainerPort) - .containsOnly(Constants.CONSOLE_PORT); + .containsOnly(ArtemisConstants.CONSOLE_PORT); ResourceManager.deleteArtemis(testNamespace, broker); } @@ -176,12 +177,12 @@ void verifyServiceContainerPort() { List amqPorts = svc.getSpec().getPorts(); assertThat(String.format("List of AMQ Ports did not consist of the expected items: %s", amqPorts), amqPorts, contains( - hasProperty("name", Matchers.is(Constants.WEBCONSOLE_URI_PREFIX)), - hasProperty("name", is(Constants.WEBCONSOLE_URI_PREFIX + "-0")))); + hasProperty("name", Matchers.is(ArtemisConstants.WEBCONSOLE_URI_PREFIX)), + hasProperty("name", is(ArtemisConstants.WEBCONSOLE_URI_PREFIX + "-0")))); Assertions.assertThat(amqPorts) - .filteredOn("name", Constants.WEBCONSOLE_URI_PREFIX) + .filteredOn("name", ArtemisConstants.WEBCONSOLE_URI_PREFIX) .extracting(ServicePort::getPort) - .containsOnly(Constants.CONSOLE_PORT); + .containsOnly(ArtemisConstants.CONSOLE_PORT); ResourceManager.deleteArtemis(testNamespace, broker); } @@ -676,12 +677,12 @@ void invalidRouteNameTest() { containsString(brokerName), containsString("must be no more than 63 characters, metadata.labels: Invalid value") )); - boolean logStatus = ResourceManager.getArtemisStatus(testNamespace, broker, Constants.CONDITION_TYPE_DEPLOYED, - Constants.CONDITION_REASON_RESOURCE_ERROR, "must be no more than 63 characters, metadata.labels: Invalid value: \\\"" + brokerName); + boolean logStatus = ResourceManager.getArtemisStatus(testNamespace, broker, ArtemisConstants.CONDITION_TYPE_DEPLOYED, + ArtemisConstants.CONDITION_REASON_RESOURCE_ERROR, "must be no more than 63 characters, metadata.labels: Invalid value: \\\"" + brokerName); assertThat("Artemis ready condition does not match", logStatus); - boolean readyCondition = ResourceManager.getArtemisStatus(testNamespace, broker, Constants.CONDITION_TYPE_READY, - Constants.CONDITION_REASON_WAITING_FOR_ALL_CONDITIONS, "Some conditions are not met"); + boolean readyCondition = ResourceManager.getArtemisStatus(testNamespace, broker, ArtemisConstants.CONDITION_TYPE_READY, + ArtemisConstants.CONDITION_REASON_WAITING_FOR_ALL_CONDITIONS, "Some conditions are not met"); assertThat("Artemis ready condition does not match", readyCondition); ResourceManager.deleteArtemis(testNamespace, broker); @@ -753,7 +754,7 @@ void routeCreationNonAscii() { .endSpec().build(); broker = ResourceManager.createArtemis(testNamespace, broker, false); // This is speculative expectation, to be fixed in future. - ResourceManager.waitForArtemisStatusUpdate(testNamespace, broker, Constants.CONDITION_TYPE_VALID, Constants.CONDITION_FALSE, Constants.DURATION_5_MINUTES, false); + ResourceManager.waitForArtemisStatusUpdate(testNamespace, broker, ArtemisConstants.CONDITION_TYPE_VALID, ArtemisConstants.CONDITION_FALSE, Constants.DURATION_5_MINUTES, false); ResourceManager.deleteArtemis(testNamespace, broker); } } diff --git a/operator-suite/src/test/java/io/brokerqe/claire/configuration/BrokerCustomResourceStatusTests.java b/operator-suite/src/test/java/io/brokerqe/claire/configuration/BrokerCustomResourceStatusTests.java index 56ed2bd8..8b172894 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/configuration/BrokerCustomResourceStatusTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/configuration/BrokerCustomResourceStatusTests.java @@ -9,6 +9,7 @@ import io.amq.broker.v1beta1.ActiveMQArtemisSpec; import io.amq.broker.v1beta1.activemqartemisstatus.Conditions; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; @@ -57,7 +58,7 @@ void testBrokerPropertiesApplication() { .build(); // We don't wait for deployment since we wait for Status update instead in next call. broker = ResourceManager.createArtemis(testNamespace, broker, false); - ResourceManager.waitForArtemisStatusUpdate(testNamespace, broker, Constants.CONDITION_TYPE_DEPLOYED, Constants.CONDITION_REASON_ALL_PODS_READY, Constants.DURATION_5_MINUTES, false); + ResourceManager.waitForArtemisStatusUpdate(testNamespace, broker, ArtemisConstants.CONDITION_TYPE_DEPLOYED, ArtemisConstants.CONDITION_REASON_ALL_PODS_READY, Constants.DURATION_5_MINUTES, false); LOGGER.info("[{}] ActiveMQArtemis Status CR: {}", testNamespace, broker.getMetadata().getName()); broker = ResourceManager.getArtemisClient().inNamespace(testNamespace).resource(broker).get(); LOGGER.debug("[{}] ActiveMQArtemis CR status update received:\n{}", testNamespace, broker.getStatus()); @@ -66,7 +67,7 @@ void testBrokerPropertiesApplication() { for (Conditions condition : broker.getStatus().getConditions()) { // assert that all conditions have "True" status assertThat(String.format("Condition %s did not reach its expected status, reason: %s, message: %s", condition.getType(), condition.getReason(), condition.getMessage()), - condition.getStatus().getValue(), is(equalTo(Constants.CONDITION_TRUE))); + condition.getStatus().getValue(), is(equalTo(ArtemisConstants.CONDITION_TRUE))); } ResourceManager.deleteArtemis(testNamespace, broker); } @@ -101,8 +102,8 @@ private void testBrokerProperty(ActiveMQArtemis broker, String brokerProperty, S void testBrokerPropertiesWrongProperty() { ActiveMQArtemis broker = ResourceManager.createArtemis(testNamespace, CONFIG_BROKER_NAME); testBrokerProperty(broker, "emptyProperty=emptyValue", - Constants.CONDITION_REASON_APPLIED_WITH_ERROR, - Constants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, + ArtemisConstants.CONDITION_REASON_APPLIED_WITH_ERROR, + ArtemisConstants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, "Broker properties didn't error out as expected"); ResourceManager.deleteArtemis(testNamespace, broker); } @@ -111,8 +112,8 @@ void testBrokerPropertiesWrongProperty() { void testBrokerPropertyInvalidValue() { ActiveMQArtemis broker = ResourceManager.createArtemis(testNamespace, CONFIG_BROKER_NAME); testBrokerProperty(broker, "networkCheckPeriod=somestring", - Constants.CONDITION_REASON_APPLIED_WITH_ERROR, - Constants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, + ArtemisConstants.CONDITION_REASON_APPLIED_WITH_ERROR, + ArtemisConstants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, "Broker properties didn't error out as expected"); ResourceManager.deleteArtemis(testNamespace, broker); } @@ -121,8 +122,8 @@ void testBrokerPropertyInvalidValue() { void testBrokerPropertiesValidProperty() { ActiveMQArtemis broker = ResourceManager.createArtemis(testNamespace, CONFIG_BROKER_NAME); testBrokerProperty(broker, "networkCheckPeriod=20000", - Constants.CONDITION_REASON_APPLIED, - Constants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, + ArtemisConstants.CONDITION_REASON_APPLIED, + ArtemisConstants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, "Broker property was not applied as expected"); ResourceManager.deleteArtemis(testNamespace, broker); } @@ -131,16 +132,16 @@ void testBrokerPropertiesValidProperty() { void testBrokerCRValidityTest() { ActiveMQArtemis broker = ResourceManager.createArtemis(testNamespace, CONFIG_BROKER_NAME); ResourceManager.waitForArtemisStatusUpdate(testNamespace, broker, - Constants.CONDITION_TYPE_VALID, - Constants.CONDITION_REASON_VALIDATION, + ArtemisConstants.CONDITION_TYPE_VALID, + ArtemisConstants.CONDITION_REASON_VALIDATION, Constants.DURATION_5_MINUTES, false); broker = ResourceManager.getArtemisClient().inNamespace(testNamespace).resource(broker).get(); LOGGER.info("Checking for the expected conditions on Broker CR status"); assertThat("Default status fields didn't contain what was expected", broker.getStatus().getConditions(), containsInAnyOrder( - hasProperty("type", is(Constants.CONDITION_TYPE_VALID)), - hasProperty("type", is(Constants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED)), - hasProperty("type", is(Constants.CONDITION_TYPE_READY)), - hasProperty("type", is(Constants.CONDITION_TYPE_DEPLOYED)) + hasProperty("type", is(ArtemisConstants.CONDITION_TYPE_VALID)), + hasProperty("type", is(ArtemisConstants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED)), + hasProperty("type", is(ArtemisConstants.CONDITION_TYPE_READY)), + hasProperty("type", is(ArtemisConstants.CONDITION_TYPE_DEPLOYED)) )); ResourceManager.deleteArtemis(testNamespace, broker); } diff --git a/operator-suite/src/test/java/io/brokerqe/claire/logging/ArtemisLoggingTests.java b/operator-suite/src/test/java/io/brokerqe/claire/logging/ArtemisLoggingTests.java index bdd7daad..336b7606 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/logging/ArtemisLoggingTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/logging/ArtemisLoggingTests.java @@ -7,6 +7,7 @@ import io.amq.broker.v1beta1.ActiveMQArtemis; import io.amq.broker.v1beta1.ActiveMQArtemisBuilder; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; @@ -44,8 +45,6 @@ public class ArtemisLoggingTests extends AbstractSystemTests { private static final String LOGGER_CONFIG_MAP_NAME = "artemis-cm-logging-config"; private static final String LOGGER_SECRET_NAME = "artemis-secret-logging-config"; private static final String LOGGING_PROPERTIES_KEY = "logging.properties"; - private static final String AUDIT_LOG_FILE = "audit.log"; - private static final String ARTEMIS_LOG_FILE = "artemis.log"; private static final String LOGGING_MOUNT_ONLY_ONCE = "Spec.DeploymentPlan.ExtraMounts, entry with suffix -logging-config can only be supplied once"; private final String testNamespace = getRandomNamespaceName("artemis-log-tests", 3); @@ -67,8 +66,10 @@ void defaultLoggingTest() { Pod artemisPod = getClient().getFirstPodByPrefixName(testNamespace, artemisName); String artemisLogs = getClient().getLogsFromPod(artemisPod); + LOGGER.info("[{}] Ensure artemis pod logs contains using default log message", testNamespace); + assertThat(artemisLogs, containsString(ArtemisConstants.USING_DEFAULT_LOG_MSG)); LOGGER.info("[{}] Ensure artemis pod logs contains INFO level", testNamespace); - assertThat(artemisLogs, containsString(Constants.ARTEMIS_IS_LIVE_LOG_MSG)); + assertThat(artemisLogs, containsString(ArtemisConstants.IS_LIVE_LOG_MSG)); assertLogIsNotInFilesystem(artemisPod); @@ -140,8 +141,8 @@ void providedLoggingUsingConfigMapTest() throws IOException { private void assertLoggingDoesNotContainsException(Pod artemisPod) { LOGGER.info("[{}] Ensure artemis pod logs does not contains java exceptions", testNamespace); String artemisLogs = getClient().getLogsFromPod(artemisPod); - org.assertj.core.api.Assertions.assertThat(artemisLogs).doesNotContain(Constants.ARTEMIS_LOG_EXCEPTION); - org.assertj.core.api.Assertions.assertThat(artemisLogs).doesNotContain(Constants.ARTEMIS_LOG_EXCEPTION_CAUSE); + org.assertj.core.api.Assertions.assertThat(artemisLogs).doesNotContain(ArtemisConstants.LOG_EXCEPTION); + org.assertj.core.api.Assertions.assertThat(artemisLogs).doesNotContain(ArtemisConstants.LOG_EXCEPTION_CAUSE); } @Test @@ -169,7 +170,7 @@ void providedLoggingUsingEmptyConfigMapTest() { String artemisLogs = getClient().getLogsFromPod(artemisPod); LOGGER.info("[{}] Ensure artemis pod logs not contains INFO level", testNamespace); - assertThat(artemisLogs, not(containsString(Constants.ARTEMIS_IS_LIVE_LOG_MSG))); + assertThat(artemisLogs, not(containsString(ArtemisConstants.IS_LIVE_LOG_MSG))); assertLogIsNotInFilesystem(artemisPod); ResourceManager.deleteArtemis(testNamespace, artemis); @@ -202,8 +203,8 @@ void providedLoggingUsingConfigMapAndSecretTest() { .build(); assertThrows(WaitException.class, () -> ResourceManager.createArtemis(testNamespace, artemis, true, Constants.DURATION_30_SECONDS)); - boolean logStatus = ResourceManager.getArtemisStatus(testNamespace, artemis, Constants.CONDITION_TYPE_VALID, - Constants.CONDITION_REASON_INVALID_EXTRA_MOUNT, LOGGING_MOUNT_ONLY_ONCE); + boolean logStatus = ResourceManager.getArtemisStatus(testNamespace, artemis, ArtemisConstants.CONDITION_TYPE_VALID, + ArtemisConstants.CONDITION_REASON_INVALID_EXTRA_MOUNT, LOGGING_MOUNT_ONLY_ONCE); assertThat("Artemis condition does not match", Boolean.TRUE, is(logStatus)); ResourceManager.deleteArtemis(testNamespace, artemis); @@ -216,7 +217,7 @@ private void assertLogIsNotInFilesystem(Pod artemisPod) { String testDirName = testInfo.getTestClass().orElseThrow().getName() + Constants.FILE_SEPARATOR + testInfo.getTestMethod().orElseThrow().getName(); Path tmpDirName = TestUtils.createTestTemporaryDir(testDirName, testEnvironmentOperator.getTmpDirLocation()); - Path logDestDir = getClient().copyPodDir(artemisPod, Constants.CONTAINER_BROKER_HOME_LOG_DIR, tmpDirName); + Path logDestDir = getClient().copyPodDir(artemisPod, ArtemisConstants.CONTAINER_BROKER_HOME_LOG_DIR, tmpDirName); assertThat(Files.isDirectory(logDestDir), is(Boolean.TRUE)); try (Stream entries = Files.list(logDestDir)) { entries.forEach(e -> assertThat(e.toFile().length(), equalTo(0L))); @@ -230,17 +231,17 @@ private void assertLoggingIsInFilesystem(Pod artemisPod) throws IOException { String testDirName = testInfo.getTestClass().orElseThrow().getName() + Constants.FILE_SEPARATOR + testInfo.getTestMethod().orElseThrow().getName(); Path tmpDirName = TestUtils.createTestTemporaryDir(testDirName, testEnvironmentOperator.getTmpDirLocation()); - Path logDestDir = getClient().copyPodDir(artemisPod, Constants.CONTAINER_BROKER_HOME_LOG_DIR, tmpDirName); + Path logDestDir = getClient().copyPodDir(artemisPod, ArtemisConstants.CONTAINER_BROKER_HOME_LOG_DIR, tmpDirName); assertThat(Files.isDirectory(logDestDir), is(Boolean.TRUE)); - LOGGER.info("[{}] Ensure artemis pod is logging into " + ARTEMIS_LOG_FILE + " into filesystem", testNamespace); - Path artemisLogFile = Paths.get(logDestDir + Constants.FILE_SEPARATOR + ARTEMIS_LOG_FILE); + LOGGER.info("[{}] Ensure artemis pod is logging into " + ArtemisConstants.ARTEMIS_LOG_FILE + " into filesystem", testNamespace); + Path artemisLogFile = Paths.get(logDestDir + Constants.FILE_SEPARATOR + ArtemisConstants.ARTEMIS_LOG_FILE); assertThat(artemisLogFile.toFile().length(), greaterThan(0L)); List artemisLogs = Files.readAllLines(artemisLogFile); - assertThat(artemisLogs, hasItem(containsString(Constants.ARTEMIS_IS_LIVE_LOG_MSG))); + assertThat(artemisLogs, hasItem(containsString(ArtemisConstants.IS_LIVE_LOG_MSG))); - LOGGER.info("[{}] Ensure artemis pod is logging into " + AUDIT_LOG_FILE + " into filesystem", testNamespace); - Path auditLogFile = Paths.get(logDestDir + Constants.FILE_SEPARATOR + AUDIT_LOG_FILE); + LOGGER.info("[{}] Ensure artemis pod is logging into " + ArtemisConstants.AUDIT_LOG_FILE + " into filesystem", testNamespace); + Path auditLogFile = Paths.get(logDestDir + Constants.FILE_SEPARATOR + ArtemisConstants.AUDIT_LOG_FILE); assertThat(auditLogFile.toFile().length(), greaterThan(0L)); List auditLogs = Files.readAllLines(auditLogFile); assertThat(auditLogs, hasItem(containsString(" [AUDIT]"))); diff --git a/operator-suite/src/test/java/io/brokerqe/claire/monitoring/PrometheusTests.java b/operator-suite/src/test/java/io/brokerqe/claire/monitoring/PrometheusTests.java index b81b7b6c..8f62d26e 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/monitoring/PrometheusTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/monitoring/PrometheusTests.java @@ -8,6 +8,7 @@ import io.amq.broker.v1beta1.ActiveMQArtemisBuilder; import io.amq.broker.v1beta1.activemqartemisspec.Acceptors; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; @@ -318,7 +319,7 @@ void jvmMetricsBrokerConfigurationUpdateTest() { LOGGER.debug("[{}] Broker Properties: {}", testNamespace, brokerProperties); // DateTime needs to be measured before call to createOrReplace due to timing issues otherwise ActiveMQArtemis initialArtemis = ResourceManager.createArtemis(testNamespace, broker); - ResourceManager.waitForArtemisStatusUpdate(testNamespace, initialArtemis, Constants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, Constants.CONDITION_REASON_APPLIED, Constants.DURATION_5_MINUTES); + ResourceManager.waitForArtemisStatusUpdate(testNamespace, initialArtemis, ArtemisConstants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, ArtemisConstants.CONDITION_REASON_APPLIED, Constants.DURATION_5_MINUTES); metrics = prometheus.getMetrics(0, broker.getMetadata().getName()); LOGGER.trace("[{}] Got metrics: {}", testNamespace, metrics); for (String item : keysGc) { @@ -335,7 +336,7 @@ void jvmMetricsBrokerConfigurationUpdateTest() { LOGGER.info("[{}] Updating Broker deployment to enable GC metrics", testNamespace); LOGGER.debug("[{}] Broker Properties: {}", testNamespace, brokerProperties); initialArtemis = ResourceManager.createArtemis(testNamespace, broker); - ResourceManager.waitForArtemisStatusUpdate(testNamespace, initialArtemis, Constants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, Constants.CONDITION_REASON_APPLIED, Constants.DURATION_5_MINUTES); + ResourceManager.waitForArtemisStatusUpdate(testNamespace, initialArtemis, ArtemisConstants.CONDITION_TYPE_BROKER_PROPERTIES_APPLIED, ArtemisConstants.CONDITION_REASON_APPLIED, Constants.DURATION_5_MINUTES); LOGGER.info("[{}] waiting for Broker pod {} to reload BrokerProperties configuration", testNamespace, broker.getMetadata().getName()); TestUtils.threadSleep(Constants.DURATION_5_SECONDS); metrics = prometheus.getMetrics(0, broker.getMetadata().getName()); diff --git a/operator-suite/src/test/java/io/brokerqe/claire/security/KeycloakLdapTests.java b/operator-suite/src/test/java/io/brokerqe/claire/security/KeycloakLdapTests.java index f1c58317..5d720d80 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/security/KeycloakLdapTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/security/KeycloakLdapTests.java @@ -7,6 +7,7 @@ import io.amq.broker.v1beta1.ActiveMQArtemisBuilder; import io.amq.broker.v1beta1.activemqartemisspec.Acceptors; import io.amq.broker.v1beta1.activemqartemisspec.EnvBuilder; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; @@ -65,7 +66,7 @@ public void createArtemisKeycloakSecurity() { String clientSecretId = keycloak.getClientSecretId(keycloakRealm, "amq-broker"); Map jaasData = Map.of( - Constants.LOGIN_CONFIG_CONFIG_KEY, """ + ArtemisConstants.LOGIN_CONFIG_CONFIG_KEY, """ console { // ensure the operator can connect to the broker by referencing the existing properties config org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient @@ -134,7 +135,7 @@ public void setupEnvironment() { createArtemisKeycloakSecurity(); getClient().createConfigMap(testNamespace, "debug-logging-config", - Map.of(Constants.LOGGING_PROPERTIES_CONFIG_KEY, """ + Map.of(ArtemisConstants.LOGGING_PROPERTIES_CONFIG_KEY, """ appender.stdout.name = STDOUT appender.stdout.type = Console appender.stdout.layout.type=PatternLayout @@ -202,7 +203,7 @@ public void setupEnvironment() { Map keystores = CertificateManager.generateDefaultCertificateKeystores( ResourceManager.generateDefaultBrokerDN(), ResourceManager.generateDefaultClientDN(), - List.of(ResourceManager.generateSanDnsNames(broker, List.of(amqpAcceptorName, Constants.WEBCONSOLE_URI_PREFIX))), + List.of(ResourceManager.generateSanDnsNames(broker, List.of(amqpAcceptorName, ArtemisConstants.WEBCONSOLE_URI_PREFIX))), null ); getClient().createSecretEncodedData(testNamespace, consoleSecretName, CertificateManager.createConsoleKeystoreSecret(keystores)); diff --git a/operator-suite/src/test/java/io/brokerqe/claire/security/LdapTests.java b/operator-suite/src/test/java/io/brokerqe/claire/security/LdapTests.java index db9d7f38..48f6b07a 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/security/LdapTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/security/LdapTests.java @@ -9,8 +9,8 @@ import io.amq.broker.v1beta1.ActiveMQArtemisBuilder; import io.amq.broker.v1beta1.activemqartemisspec.Acceptors; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; -import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; import io.brokerqe.claire.clients.ClientType; import io.brokerqe.claire.clients.MessagingClient; @@ -48,10 +48,10 @@ public class LdapTests extends AbstractSystemTests { final boolean jwtTokenSupported = false; Map users = Map.of( - "alice", "alice", - "bob", "bob", - "charlie", "charlie", - "lala", "lala"); + ArtemisConstants.ALICE_NAME, ArtemisConstants.ALICE_PASS, + ArtemisConstants.BOB_NAME, ArtemisConstants.BOB_PASS, + ArtemisConstants.CHARLIE_NAME, ArtemisConstants.CHARLIE_PASS, + ArtemisConstants.LALA_NAME, ArtemisConstants.LALA_PASS); @BeforeAll void setupClusterOperator() { @@ -71,7 +71,7 @@ void teardownClusterOperator() { private void setupEnvironment() { Map jaasData = Map.of( - Constants.LOGIN_CONFIG_CONFIG_KEY, """ + ArtemisConstants.LOGIN_CONFIG_CONFIG_KEY, """ activemq { org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient reload=false @@ -102,7 +102,7 @@ private void setupEnvironment() { getClient().createSecretStringData(testNamespace, secretName, jaasData, true); getClient().createConfigMap(testNamespace, "debug-logging-config", - Map.of(Constants.LOGGING_PROPERTIES_CONFIG_KEY, """ + Map.of(ArtemisConstants.LOGGING_PROPERTIES_CONFIG_KEY, """ appender.stdout.name = STDOUT appender.stdout.type = Console rootLogger = info, STDOUT @@ -169,26 +169,26 @@ String getTestNamespace() { @Test public void testSenderReceiverLdapUsers() { int messages = 5; - String alicePass = getPassword("alice"); - String bobPass = getPassword("bob"); + String alicePass = getPassword(ArtemisConstants.ALICE_NAME); + String bobPass = getPassword(ArtemisConstants.BOB_NAME); - LOGGER.info("[{}] Trying to send messages as {} with {}", getTestNamespace(), "alice", alicePass); + LOGGER.info("[{}] Trying to send messages as {} with {}", getTestNamespace(), ArtemisConstants.ALICE_NAME, alicePass); MessagingClient producerAlice = ResourceManager.createMessagingClient(ClientType.BUNDLED_CORE, brokerPod, - allDefaultPort, ldapAddress, messages, "alice", alicePass); + allDefaultPort, ldapAddress, messages, ArtemisConstants.ALICE_NAME, alicePass); int sentAlice = producerAlice.sendMessages(); - LOGGER.info("[{}] Trying to receive messages as {} with {}", getTestNamespace(), "alice", alicePass); + LOGGER.info("[{}] Trying to receive messages as {} with {}", getTestNamespace(), ArtemisConstants.ALICE_NAME, alicePass); Throwable t = assertThrows(MessagingClientException.class, producerAlice::receiveMessages); assertThat(t.getMessage(), containsString("does not have permission='CONSUME' for queue")); - LOGGER.info("[{}] Trying to receive messages as {} with {}", getTestNamespace(), "bob", bobPass); + LOGGER.info("[{}] Trying to receive messages as {} with {}", getTestNamespace(), ArtemisConstants.BOB_NAME, bobPass); MessagingClient consumerBob = ResourceManager.createMessagingClient(ClientType.BUNDLED_CORE, brokerPod, - allDefaultPort, ldapAddress, messages, "bob", bobPass); + allDefaultPort, ldapAddress, messages, ArtemisConstants.BOB_NAME, bobPass); int consumedBob = consumerBob.receiveMessages(); assertThat(sentAlice, equalTo(messages)); assertThat(sentAlice, equalTo(consumedBob)); - LOGGER.info("[{}] Trying to send messages as {} with {}", getTestNamespace(), "bob", bobPass); + LOGGER.info("[{}] Trying to send messages as {} with {}", getTestNamespace(), ArtemisConstants.BOB_NAME, bobPass); t = assertThrows(MessagingClientException.class, consumerBob::sendMessages); assertThat(t.getMessage(), containsString("does not have permission='SEND' on address")); } @@ -196,10 +196,10 @@ public void testSenderReceiverLdapUsers() { @Test public void testSingleUserWithPermissions() { int messages = 5; - String charliePass = getPassword("charlie"); - LOGGER.info("[{}] Send & receive messages as {} with {}", getTestNamespace(), "charlie", charliePass); + String charliePass = getPassword(ArtemisConstants.CHARLIE_NAME); + LOGGER.info("[{}] Send & receive messages as {} with {}", getTestNamespace(), ArtemisConstants.CHARLIE_NAME, charliePass); MessagingClient clientCharlie = ResourceManager.createMessagingClient(ClientType.BUNDLED_CORE, brokerPod, - allDefaultPort, ldapAddress, messages, "charlie", charliePass); + allDefaultPort, ldapAddress, messages, ArtemisConstants.CHARLIE_NAME, charliePass); int sent = clientCharlie.sendMessages(); int received = clientCharlie.receiveMessages(); assertThat(sent, equalTo(messages)); @@ -209,25 +209,25 @@ public void testSingleUserWithPermissions() { @Test public void testSingleUserWithPermissionsAmqp() { int messages = 5; - String charliePass = getPassword("charlie"); - LOGGER.info("[{}] Send & receive amqp messages as {} with {}", getTestNamespace(), "charlie", charliePass); - testMessaging(ClientType.BUNDLED_AMQP, getTestNamespace(), brokerPod, ldapAddress, messages, "charlie", charliePass); + String charliePass = getPassword(ArtemisConstants.CHARLIE_NAME); + LOGGER.info("[{}] Send & receive amqp messages as {} with {}", getTestNamespace(), ArtemisConstants.CHARLIE_NAME, charliePass); + testMessaging(ClientType.BUNDLED_AMQP, getTestNamespace(), brokerPod, ldapAddress, messages, ArtemisConstants.CHARLIE_NAME, charliePass); } @Test public void testWrongUser() { int messages = 2; // invalid user - LOGGER.info("[{}] Trying to connect as invalid user {} with {}", getTestNamespace(), "lala", "lala"); + LOGGER.info("[{}] Trying to connect as invalid user {} with {}", getTestNamespace(), ArtemisConstants.LALA_NAME, ArtemisConstants.LALA_PASS); MessagingClient wrongUser = ResourceManager.createMessagingClient(ClientType.BUNDLED_CORE, brokerPod, - allDefaultPort, ldapAddress, messages, "lala", "lala"); + allDefaultPort, ldapAddress, messages, ArtemisConstants.LALA_NAME, ArtemisConstants.LALA_PASS); Throwable t = assertThrows(MessagingClientException.class, wrongUser::sendMessages); assertThat(t.getMessage(), containsString("Unable to validate user from")); // incorrect pass - LOGGER.info("[{}] Trying to connect as {} with invalid password {}", getTestNamespace(), "charlie", "lala"); + LOGGER.info("[{}] Trying to connect as {} with invalid password {}", getTestNamespace(), ArtemisConstants.CHARLIE_NAME, ArtemisConstants.LALA_PASS); wrongUser = ResourceManager.createMessagingClient(ClientType.BUNDLED_CORE, brokerPod, - allDefaultPort, ldapAddress, messages, "charlie", "lala"); + allDefaultPort, ldapAddress, messages, ArtemisConstants.CHARLIE_NAME, ArtemisConstants.LALA_PASS); t = assertThrows(MessagingClientException.class, wrongUser::sendMessages); assertThat(t.getMessage(), containsString("Unable to validate user from")); } diff --git a/operator-suite/src/test/java/io/brokerqe/claire/security/SimpleSecurityTests.java b/operator-suite/src/test/java/io/brokerqe/claire/security/SimpleSecurityTests.java index 66570e91..bf887489 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/security/SimpleSecurityTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/security/SimpleSecurityTests.java @@ -12,6 +12,7 @@ import io.amq.broker.v1beta1.activemqartemissecurityspec.loginmodules.PropertiesLoginModulesBuilder; import io.amq.broker.v1beta1.activemqartemissecurityspec.loginmodules.propertiesloginmodules.UsersBuilder; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; @@ -103,7 +104,7 @@ void userPropertiesSecretTest() { .endSpec() .build(); - String cmd = "cat " + Constants.CONTAINER_BROKER_HOME_ETC_DIR + "artemis-users.properties"; + String cmd = "cat " + ArtemisConstants.CONTAINER_BROKER_HOME_ETC_DIR + "artemis-users.properties"; Pod brokerPod = getClient().getFirstPodByPrefixName(testNamespace, brokerName); String usersPropertiesFile = getClient().executeCommandInPod(brokerPod, cmd, Constants.DURATION_10_SECONDS); assertThat(usersPropertiesFile, not(containsString("alice"))); diff --git a/operator-suite/src/test/java/io/brokerqe/claire/security/TLSAuthorizationTests.java b/operator-suite/src/test/java/io/brokerqe/claire/security/TLSAuthorizationTests.java index 4c401d41..bec0424a 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/security/TLSAuthorizationTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/security/TLSAuthorizationTests.java @@ -14,6 +14,7 @@ import io.amq.broker.v1beta1.activemqartemissecurityspec.securitysettings.broker.PermissionsBuilder; import io.amq.broker.v1beta1.activemqartemisspec.Acceptors; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; @@ -98,7 +99,7 @@ void teardownDeployment() { protected void createArtemisDeployment() { Map jaasData = Map.of( - Constants.LOGIN_CONFIG_CONFIG_KEY, """ + ArtemisConstants.LOGIN_CONFIG_CONFIG_KEY, """ activemq { org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient reload=false @@ -129,7 +130,7 @@ protected void createArtemisDeployment() { getClient().createSecretStringData(testNamespace, secretName, jaasData, true); getClient().createConfigMap(testNamespace, "debug-logging-config", - Map.of(Constants.LOGGING_PROPERTIES_CONFIG_KEY, """ + Map.of(ArtemisConstants.LOGGING_PROPERTIES_CONFIG_KEY, """ appender.stdout.name = STDOUT appender.stdout.type = Console rootLogger = info, STDOUT diff --git a/operator-suite/src/test/java/io/brokerqe/claire/security/TLSCACertsTests.java b/operator-suite/src/test/java/io/brokerqe/claire/security/TLSCACertsTests.java index 93c476f8..10a3731a 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/security/TLSCACertsTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/security/TLSCACertsTests.java @@ -4,6 +4,7 @@ */ package io.brokerqe.claire.security; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; import io.brokerqe.claire.operator.ArtemisFileProvider; @@ -83,7 +84,7 @@ private void setupCertificates() { Map keystores = CertificateManager.generateDefaultCertificateKeystores( ResourceManager.generateDefaultBrokerDN(), ResourceManager.generateDefaultClientDN(), - List.of(ResourceManager.generateSanDnsNames(broker, List.of(amqpAcceptorName, Constants.WEBCONSOLE_URI_PREFIX))), + List.of(ResourceManager.generateSanDnsNames(broker, List.of(amqpAcceptorName, ArtemisConstants.WEBCONSOLE_URI_PREFIX))), myCACertData ); diff --git a/operator-suite/src/test/java/io/brokerqe/claire/security/TLSProviderTests.java b/operator-suite/src/test/java/io/brokerqe/claire/security/TLSProviderTests.java index 602ceb35..e4a50c73 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/security/TLSProviderTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/security/TLSProviderTests.java @@ -9,6 +9,7 @@ import io.amq.broker.v1beta1.ActiveMQArtemisBuilder; import io.amq.broker.v1beta1.activemqartemisspec.Acceptors; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; @@ -143,7 +144,7 @@ void testTLSProviders(String sslProvider) { } private void assertBrokerConfigHasSslProvider(Pod artemisPod, String sslProvider) { - String cmd = "grep \"acceptor name=\" " + Constants.CONTAINER_BROKER_HOME_ETC_DIR + "broker.xml"; + String cmd = "grep \"acceptor name=\" " + ArtemisConstants.CONTAINER_BROKER_HOME_ETC_DIR + "broker.xml"; String acceptors = getClient().executeCommandInPod(artemisPod, cmd, Constants.DURATION_10_SECONDS); if (sslProvider == null || sslProvider.isEmpty()) { diff --git a/operator-suite/src/test/java/io/brokerqe/claire/security/TLSSelfSignedCertsTests.java b/operator-suite/src/test/java/io/brokerqe/claire/security/TLSSelfSignedCertsTests.java index bff4f788..061580d1 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/security/TLSSelfSignedCertsTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/security/TLSSelfSignedCertsTests.java @@ -4,6 +4,7 @@ */ package io.brokerqe.claire.security; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; import io.brokerqe.claire.operator.ArtemisFileProvider; @@ -80,7 +81,7 @@ void setupCertificates() { Map keystores = CertificateManager.generateDefaultCertificateKeystores( ResourceManager.generateDefaultBrokerDN(), ResourceManager.generateDefaultClientDN(), - List.of(ResourceManager.generateSanDnsNames(broker, List.of(amqpAcceptorName, Constants.WEBCONSOLE_URI_PREFIX))), + List.of(ResourceManager.generateSanDnsNames(broker, List.of(amqpAcceptorName, ArtemisConstants.WEBCONSOLE_URI_PREFIX))), null ); diff --git a/operator-suite/src/test/java/io/brokerqe/claire/webconsole/WebConsoleTests.java b/operator-suite/src/test/java/io/brokerqe/claire/webconsole/WebConsoleTests.java index 4e01059a..763a99cf 100644 --- a/operator-suite/src/test/java/io/brokerqe/claire/webconsole/WebConsoleTests.java +++ b/operator-suite/src/test/java/io/brokerqe/claire/webconsole/WebConsoleTests.java @@ -7,6 +7,7 @@ import io.amq.broker.v1beta1.ActiveMQArtemis; import io.amq.broker.v1beta1.ActiveMQArtemisBuilder; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.KubernetesPlatform; @@ -106,7 +107,7 @@ public void unsecuredConsoleTLSExternalAccessTest() { ResourceManager.createArtemis(testNamespace, artemis, true); List webserviceUrl = getClient().getExternalAccessServicePrefixName(testNamespace, - brokerName + "-" + Constants.WEBCONSOLE_URI_PREFIX); + brokerName + "-" + ArtemisConstants.WEBCONSOLE_URI_PREFIX); for (HasMetadata service : webserviceUrl) { String serviceUrl = getClient().getExternalAccessServiceUrl(testNamespace, service.getMetadata().getName()); LOGGER.debug("[{}] Using webservice url {}", testNamespace, serviceUrl); @@ -174,14 +175,14 @@ public void doConnectSecurelyConsoleTest(boolean checkLogForSecret) { Map keystores = CertificateManager.generateDefaultCertificateKeystores( ResourceManager.generateDefaultBrokerDN(), ResourceManager.generateDefaultClientDN(), - List.of(ResourceManager.generateSanDnsNames(artemis, List.of(amqpAcceptorName, Constants.WEBCONSOLE_URI_PREFIX))), + List.of(ResourceManager.generateSanDnsNames(artemis, List.of(amqpAcceptorName, ArtemisConstants.WEBCONSOLE_URI_PREFIX))), null ); Secret consoleSecret = getClient().createSecretEncodedData(testNamespace, consoleSecretName, CertificateManager.createConsoleKeystoreSecret(keystores)); Pod operatorPod = getClient().getFirstPodByPrefixName(testNamespace, operator.getOperatorName()); ResourceManager.createArtemis(testNamespace, artemis, true); - List webserviceUrl = getClient().getExternalAccessServicePrefixName(testNamespace, brokerName + "-" + Constants.WEBCONSOLE_URI_PREFIX); + List webserviceUrl = getClient().getExternalAccessServicePrefixName(testNamespace, brokerName + "-" + ArtemisConstants.WEBCONSOLE_URI_PREFIX); LOGGER.info("[{}] webservice url {}", testNamespace, webserviceUrl); if (checkLogForSecret) { diff --git a/standalone-suite/src/main/java/io/brokerqe/claire/EnvironmentStandalone.java b/standalone-suite/src/main/java/io/brokerqe/claire/EnvironmentStandalone.java index 6fd61f57..739e3086 100644 --- a/standalone-suite/src/main/java/io/brokerqe/claire/EnvironmentStandalone.java +++ b/standalone-suite/src/main/java/io/brokerqe/claire/EnvironmentStandalone.java @@ -53,7 +53,7 @@ private EnvironmentStandalone() { databaseFile = getConfigurationValue(Constants.EV_JDBC_DATA, Constants.PROP_JDBC_DATA, null); osInfo = getOSInfo(); // Default value is in logback settings file - logLevel = getConfigurationValue(Constants.EV_TEST_LOG_LEVEL, Constants.PROP_LOG_LEVEL, Constants.DEFAULT_LOG_LEVEL); + logLevel = getConfigurationValue(Constants.EV_TEST_LOG_LEVEL, Constants.PROP_LOG_LEVEL, ArtemisConstants.DEFAULT_LOG_LEVEL); logsDirLocation = getConfigurationValue(Constants.EV_LOGS_LOCATION, Constants.PROP_LOG_DIR, Constants.LOGS_DEFAULT_DIR) + Constants.FILE_SEPARATOR + generateTimestamp(); @@ -138,8 +138,8 @@ private void printAllUsedTestVariables() { private String getArtemisVersionFromInstallDir() { String version; - Path installBinDir = TestUtils.getProjectRelativeFilePath(Constants.ARTEMIS_INSTALL_DIR - + Constants.FILE_SEPARATOR + Constants.BIN_DIR); + Path installBinDir = TestUtils.getProjectRelativeFilePath(ArtemisConstants.INSTALL_DIR + + Constants.FILE_SEPARATOR + ArtemisConstants.BIN_DIR); try { String[] versionCmd = {"/bin/sh", "-c", installBinDir.toAbsolutePath() + Constants.FILE_SEPARATOR + "artemis version | grep \"Apache ActiveMQ Artemis \" | cut -d \" \" -f4"}; diff --git a/standalone-suite/src/main/java/io/brokerqe/claire/StandaloneTestDataCollector.java b/standalone-suite/src/main/java/io/brokerqe/claire/StandaloneTestDataCollector.java index f798a5e1..b7514f8d 100644 --- a/standalone-suite/src/main/java/io/brokerqe/claire/StandaloneTestDataCollector.java +++ b/standalone-suite/src/main/java/io/brokerqe/claire/StandaloneTestDataCollector.java @@ -45,7 +45,7 @@ private void getBrokerFiles() { if (ContainerType.ARTEMIS == container.getContainerType()) { String containersDir = archiveDir + Constants.FILE_SEPARATOR + CONTAINERS_STRING; String containerDir = containersDir + Constants.FILE_SEPARATOR + name; - String dstDir = containerDir + Constants.FILE_SEPARATOR + Constants.ARTEMIS_INSTANCE_STRING; + String dstDir = containerDir + Constants.FILE_SEPARATOR + ArtemisConstants.INSTANCE_STRING; String srcDir = ArtemisContainer.ARTEMIS_INSTANCE_DIR; try { container.copyDirFrom(srcDir, dstDir); diff --git a/standalone-suite/src/main/java/io/brokerqe/claire/client/deployment/BundledClientDeployment.java b/standalone-suite/src/main/java/io/brokerqe/claire/client/deployment/BundledClientDeployment.java index e4361554..c33f0cb0 100644 --- a/standalone-suite/src/main/java/io/brokerqe/claire/client/deployment/BundledClientDeployment.java +++ b/standalone-suite/src/main/java/io/brokerqe/claire/client/deployment/BundledClientDeployment.java @@ -4,7 +4,7 @@ */ package io.brokerqe.claire.client.deployment; -import io.brokerqe.claire.Constants; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ResourceManager; import io.brokerqe.claire.clients.DeployableClient; import io.brokerqe.claire.exception.ClaireNotImplementedException; @@ -56,7 +56,7 @@ public Executor getExecutor() { @Override public String getExecutableHome() { - return Constants.ARTEMIS_INSTANCE_BIN_DIR; + return ArtemisConstants.INSTANCE_BIN_DIR; } @Override diff --git a/standalone-suite/src/main/java/io/brokerqe/claire/container/AbstractGenericContainer.java b/standalone-suite/src/main/java/io/brokerqe/claire/container/AbstractGenericContainer.java index 094923e3..7c415927 100644 --- a/standalone-suite/src/main/java/io/brokerqe/claire/container/AbstractGenericContainer.java +++ b/standalone-suite/src/main/java/io/brokerqe/claire/container/AbstractGenericContainer.java @@ -12,6 +12,7 @@ import com.github.dockerjava.api.command.UnpauseContainerCmd; import com.github.dockerjava.api.exception.NotFoundException; import com.github.dockerjava.api.model.Bind; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.EnvironmentStandalone; import io.brokerqe.claire.ResourceManager; @@ -236,7 +237,7 @@ public void deleteFileFrom(String file) { public void copyDirFrom(String containerDir, String hostDir) { LOGGER.debug("[Container {}] - Copying directory {} to host directory {}", name, containerDir, hostDir); - String tarDstDir = Constants.TMP_DIR; + String tarDstDir = ArtemisConstants.TMP_DIR; String tarFilename = Constants.TAR_TMP_FILE_PREFIX + TestUtils.getRandomString(6) + ".tar"; String tarFile = tarDstDir + tarFilename; executeCommand("tar", "-cf", tarFile, "-C", containerDir, "."); diff --git a/standalone-suite/src/main/java/io/brokerqe/claire/container/ArtemisContainer.java b/standalone-suite/src/main/java/io/brokerqe/claire/container/ArtemisContainer.java index 97edab33..b454f183 100644 --- a/standalone-suite/src/main/java/io/brokerqe/claire/container/ArtemisContainer.java +++ b/standalone-suite/src/main/java/io/brokerqe/claire/container/ArtemisContainer.java @@ -6,6 +6,7 @@ import com.github.dockerjava.api.command.ExecCreateCmdResponse; import com.sun.security.auth.module.UnixSystem; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.TestUtils; import io.brokerqe.claire.exception.ClaireRuntimeException; @@ -30,20 +31,13 @@ public final class ArtemisContainer extends AbstractGenericContainer { private static final Logger LOGGER = LoggerFactory.getLogger(ArtemisContainer.class); public static final String BACKUP_ANNOUNCED_LOG_REGEX = ".*AMQ221031: backup announced\\n"; - public static final int DEFAULT_ALL_PROTOCOLS_PORT = 61616; - public static final int DEFAULT_AMQP_PORT = 5672; - public static final int DEFAULT_HORNETQ_PORT = 5445; - public static final int DEFAULT_JMX_PORT = 1099; - public static final int DEFAULT_MQTT_PORT = 1883; - public static final int DEFAULT_STOMP_PORT = 61613; - public static final int DEFAULT_WEB_CONSOLE_PORT = 8161; - public static final List DEFAULT_PORTS = List.of(DEFAULT_ALL_PROTOCOLS_PORT, DEFAULT_AMQP_PORT, - DEFAULT_MQTT_PORT, DEFAULT_STOMP_PORT, DEFAULT_HORNETQ_PORT, DEFAULT_WEB_CONSOLE_PORT, DEFAULT_JMX_PORT); - public static final String ARTEMIS_INSTALL_DIR = Constants.OPT_DIR + Constants.FILE_SEPARATOR + - Constants.ARTEMIS_STRING; - public static final String ARTEMIS_INSTANCE_DIR = Constants.VAR_DIR + Constants.LIB_DIR + - Constants.FILE_SEPARATOR + Constants.ARTEMIS_INSTANCE_STRING; - public static final String ARTEMIS_INSTANCE_DATA_DIR = ARTEMIS_INSTANCE_DIR + Constants.DATA_DIR; + public static final List DEFAULT_PORTS = List.of(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT, ArtemisConstants.DEFAULT_AMQP_PORT, + ArtemisConstants.DEFAULT_MQTT_PORT, ArtemisConstants.DEFAULT_STOMP_PORT, ArtemisConstants.DEFAULT_HORNETQ_PORT, ArtemisConstants.DEFAULT_WEB_CONSOLE_PORT, ArtemisConstants.DEFAULT_JMX_PORT); + public static final String ARTEMIS_INSTALL_DIR = ArtemisConstants.OPT_DIR + Constants.FILE_SEPARATOR + + ArtemisConstants.ARTEMIS_STRING; + public static final String ARTEMIS_INSTANCE_DIR = ArtemisConstants.VAR_DIR + ArtemisConstants.LIB_DIR + + Constants.FILE_SEPARATOR + ArtemisConstants.INSTANCE_STRING; + public static final String ARTEMIS_INSTANCE_DATA_DIR = ARTEMIS_INSTANCE_DIR + ArtemisConstants.DATA_DIR; private static final String ARTEMIS_INSTANCE_CONTROLLER_CMD = "/usr/local/bin/artemis-controller.sh"; private boolean secured = false; @@ -53,7 +47,7 @@ public ArtemisContainer(String name) { } public String getArtemisInstallDir() { - return TestUtils.getProjectRelativeFile(Constants.ARTEMIS_INSTALL_DIR); + return TestUtils.getProjectRelativeFile(ArtemisConstants.INSTALL_DIR); } public String getArtemisDefaultCfgBinDir() { @@ -75,7 +69,7 @@ public void withInstallDir(String dirPath) { } public void withConfigDir(String dirPath) { - String configDir = ARTEMIS_INSTANCE_DIR + Constants.ETC_DIR; + String configDir = ARTEMIS_INSTANCE_DIR + ArtemisConstants.ETC_DIR; LOGGER.debug("[Container {}] with config dir {} = {}", name, dirPath, configDir); TestUtils.createDirectory(dirPath); withFileSystemBind(dirPath, configDir, BindMode.READ_ONLY); @@ -89,7 +83,7 @@ public void withInstanceDir(String dirPath) { } public void withConfigFile(String srcFilePath, String dstFileName) { - String destination = ARTEMIS_INSTANCE_DIR + Constants.ETC_DIR + File.separator + dstFileName; + String destination = ARTEMIS_INSTANCE_DIR + ArtemisConstants.ETC_DIR + File.separator + dstFileName; LOGGER.debug("[Container {}] with config file {} = {}", name, srcFilePath, destination); withFileSystemBind(srcFilePath, destination, BindMode.READ_ONLY); } @@ -106,7 +100,7 @@ public void withJavaHome(String dirPath) { } public void withLibFile(String srcFilePath, String dstFileName) { - String destination = ARTEMIS_INSTANCE_DIR + Constants.LIB_DIR + File.separator + dstFileName; + String destination = ARTEMIS_INSTANCE_DIR + ArtemisConstants.LIB_DIR + File.separator + dstFileName; LOGGER.debug("[Container {}] with lib file {} = {}", name, srcFilePath, destination); withFileSystemBind(srcFilePath, destination, BindMode.READ_ONLY); } @@ -122,8 +116,8 @@ public void start(Duration startupTimeout) { container.withStartupTimeout(startupTimeout); withInstallDir(getArtemisInstallDir()); withJavaHome(getArtemisJavaHomeDir()); - withFileSystemBind(getArtemisDefaultCfgBinDir(), ARTEMIS_INSTANCE_DIR + Constants.BIN_DIR, BindMode.READ_WRITE); - withFileSystemBind(getArtemisDefaultCfgLibDir(), ARTEMIS_INSTANCE_DIR + Constants.LIB_DIR, BindMode.READ_WRITE); + withFileSystemBind(getArtemisDefaultCfgBinDir(), ARTEMIS_INSTANCE_DIR + ArtemisConstants.BIN_DIR, BindMode.READ_WRITE); + withFileSystemBind(getArtemisDefaultCfgLibDir(), ARTEMIS_INSTANCE_DIR + ArtemisConstants.LIB_DIR, BindMode.READ_WRITE); long uid = new UnixSystem().getUid(); long gid = new UnixSystem().getGid(); withEnvVar(Map.of("ARTEMIS_GROUP_GID", String.valueOf(gid), "ARTEMIS_USER_UID", String.valueOf(uid))); @@ -139,20 +133,20 @@ public String getConsoleUrl() { } public String getHttpConsoleUrl() { return Constants.HTTP + "://" + this.getName() - + ":" + ArtemisContainer.DEFAULT_WEB_CONSOLE_PORT + "/" + Constants.CONSOLE_STRING; + + ":" + ArtemisConstants.DEFAULT_WEB_CONSOLE_PORT + "/" + ArtemisConstants.CONSOLE_STRING; } public String getHttpsConsoleUrl() { return Constants.HTTPS + "://" + this.getName() - + ":" + ArtemisContainer.DEFAULT_WEB_CONSOLE_PORT + "/" + Constants.CONSOLE_STRING; + + ":" + ArtemisConstants.DEFAULT_WEB_CONSOLE_PORT + "/" + ArtemisConstants.CONSOLE_STRING; } public String getLoginUrl() { - return getConsoleUrl() + "/" + Constants.AUTH_STRING + "/" + Constants.LOGIN_STRING; + return getConsoleUrl() + "/" + ArtemisConstants.AUTH_STRING + "/" + ArtemisConstants.LOGIN_STRING; } public String getLoggedInUrl() { - return getConsoleUrl() + "/" + Constants.ARTEMIS_STRING + return getConsoleUrl() + "/" + ArtemisConstants.ARTEMIS_STRING + "/artemisStatus?nid=root-org.apache.activemq.artemis-" + this.getName(); } diff --git a/standalone-suite/src/main/java/io/brokerqe/claire/helper/ArtemisJmxHelper.java b/standalone-suite/src/main/java/io/brokerqe/claire/helper/ArtemisJmxHelper.java index e7503548..5e73ecef 100644 --- a/standalone-suite/src/main/java/io/brokerqe/claire/helper/ArtemisJmxHelper.java +++ b/standalone-suite/src/main/java/io/brokerqe/claire/helper/ArtemisJmxHelper.java @@ -4,6 +4,7 @@ */ package io.brokerqe.claire.helper; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.EnvironmentStandalone; import io.brokerqe.claire.TestUtils; import io.brokerqe.claire.exception.ClaireRuntimeException; @@ -186,7 +187,7 @@ private static Optional queryControl(JMXServiceURL serviceURI, ObjectN private static JMXServiceURL getJmxUrl(ArtemisContainer artemisContainer) { JMXServiceURL url; - String hostAndPort = artemisContainer.getHostAndPort(ArtemisContainer.DEFAULT_JMX_PORT); + String hostAndPort = artemisContainer.getHostAndPort(ArtemisConstants.DEFAULT_JMX_PORT); try { url = new JMXServiceURL(JMX_URL_BASE + hostAndPort + JMX_URL_SUFFIX); } catch (MalformedURLException e) { diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/AbstractSystemTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/AbstractSystemTests.java index e8cd7173..5c2f6994 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/AbstractSystemTests.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/AbstractSystemTests.java @@ -4,6 +4,9 @@ */ package io.brokerqe.claire; +import io.brokerqe.claire.clients.DeployableClient; +import io.brokerqe.claire.clients.bundled.ArtemisCommand; +import io.brokerqe.claire.clients.bundled.BundledArtemisClient; import io.brokerqe.claire.database.Database; import io.brokerqe.claire.exception.ClaireRuntimeException; import io.brokerqe.claire.helper.ArtemisJmxHelper; @@ -46,8 +49,8 @@ public class AbstractSystemTests implements TestSeparator { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractSystemTests.class); - protected static final String DEFAULT_ALL_PORT = String.valueOf(ArtemisContainer.DEFAULT_ALL_PROTOCOLS_PORT); - protected static final String DEFAULT_AMQP_PORT = String.valueOf(ArtemisContainer.DEFAULT_AMQP_PORT); + protected static final String DEFAULT_ALL_PORT = String.valueOf(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT); + protected static final String DEFAULT_AMQP_PORT = String.valueOf(ArtemisConstants.DEFAULT_AMQP_PORT); protected Database database; @BeforeAll @@ -85,7 +88,7 @@ public ArtemisContainer setupArtemisWithDB() { if (database.getClass().getSuperclass().equals(DatabaseContainer.class)) { ((DatabaseContainer) database).start(); } - ArtemisContainer artemis = ResourceManager.getArtemisContainerInstance(Constants.ARTEMIS_STRING); + ArtemisContainer artemis = ResourceManager.getArtemisContainerInstance(ArtemisConstants.ARTEMIS_STRING); LOGGER.info("[{}] Setting up database {}", artemis.getName(), database.getName()); generateArtemisCfg(artemis, new ArrayList<>(List.of("tune_file=" + database.getTuneFile()))); artemis.withLibFile(database.getDriverFile(), database.getDriverFilename()); @@ -170,7 +173,7 @@ protected String generateYacfgProfilesContainerTestDir(String file) { + Constants.FILE_SEPARATOR + getPkgClassAsDir() + Constants.FILE_SEPARATOR + file; } - private String getTestConfigDir() { + protected String getTestConfigDir() { String cfgDir = getPkgClassAsDir(); return TestUtils.getProjectRelativeFile(Constants.ARTEMIS_TEST_CFG_DIR + Constants.FILE_SEPARATOR + cfgDir); } @@ -191,12 +194,12 @@ protected void generateArtemisCfg(ArtemisContainer artemisInstance, List protected void generateArtemisCfg(ArtemisContainer artemisInstance, List yacfgParams, String profileFileName) { String instanceDir = getTestConfigDir() + Constants.FILE_SEPARATOR + artemisInstance.getName(); - TestUtils.createDirectory(instanceDir + Constants.BIN_DIR); - TestUtils.createDirectory(instanceDir + Constants.DATA_DIR); - TestUtils.createDirectory(instanceDir + Constants.ETC_DIR); - TestUtils.createDirectory(instanceDir + Constants.LIB_DIR); - TestUtils.createDirectory(instanceDir + Constants.LOG_DIR); - TestUtils.createDirectory(instanceDir + Constants.TMP_DIR); + TestUtils.createDirectory(instanceDir + ArtemisConstants.BIN_DIR); + TestUtils.createDirectory(instanceDir + ArtemisConstants.DATA_DIR); + TestUtils.createDirectory(instanceDir + ArtemisConstants.ETC_DIR); + TestUtils.createDirectory(instanceDir + ArtemisConstants.LIB_DIR); + TestUtils.createDirectory(instanceDir + ArtemisConstants.LOG_DIR); + TestUtils.createDirectory(instanceDir + ArtemisConstants.TMP_DIR); artemisInstance.withInstanceDir(instanceDir); String artemisConfig = EnvironmentStandalone.getInstance().getProvidedArtemisConfig(); @@ -208,7 +211,7 @@ protected void generateArtemisCfg(ArtemisContainer artemisInstance, List final YacfgArtemisContainer yacfg; yacfg = ResourceManager.getYacfgArtemisContainerInstance(String.format("yacfg-%s", artemisInstance.getName())); - String instanceYacfgOutputDir = instanceDir + Constants.FILE_SEPARATOR + Constants.ETC_DIR; + String instanceYacfgOutputDir = instanceDir + Constants.FILE_SEPARATOR + ArtemisConstants.ETC_DIR; yacfg.withHostOutputDir(instanceYacfgOutputDir); if (profileFileName != null && !profileFileName.isBlank() && !profileFileName.isEmpty()) { @@ -330,4 +333,14 @@ protected NfsServerContainer getNfsServerInstance(String exportDirName) { nfsServer.start(); return nfsServer; } + + protected void deleteAddress(DeployableClient artemisDeployableClient, String name) { + BundledArtemisClient artemisClient = new BundledArtemisClient(artemisDeployableClient, ArtemisCommand.ADDRESS_DELETE, Map.of("name", name)); + artemisClient.executeCommand(); + } + + protected void deleteQueue(DeployableClient artemisDeployableClient, String name) { + BundledArtemisClient artemisClient = new BundledArtemisClient(artemisDeployableClient, ArtemisCommand.QUEUE_DELETE, Map.of("name", name)); + artemisClient.executeCommand(); + } } diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/ha/replication/FailoverReplicationTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/ha/replication/FailoverReplicationTests.java index e2505e8f..c121c33b 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/ha/replication/FailoverReplicationTests.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/ha/replication/FailoverReplicationTests.java @@ -4,6 +4,7 @@ */ package io.brokerqe.claire.ha.replication; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.AbstractSystemTests; import io.brokerqe.claire.ResourceManager; @@ -54,14 +55,14 @@ void produceOnPrimaryConsumeOnBackup() { String queueName = "TestQueue1"; // create a qpid jms client - String primaryAmqpHostAndPort = artemisPrimary.getHostAndPort(ArtemisContainer.DEFAULT_ALL_PROTOCOLS_PORT); - String backupAmqpHostAndPort = artemisBackup.getHostAndPort(ArtemisContainer.DEFAULT_ALL_PROTOCOLS_PORT); + String primaryAmqpHostAndPort = artemisPrimary.getHostAndPort(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT); + String backupAmqpHostAndPort = artemisBackup.getHostAndPort(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT); String amqpOpts = "failover.amqpOpenServerListAction=IGNORE"; String url = AmqpUtil.buildAmqFailoverUrl(amqpOpts, primaryAmqpHostAndPort, backupAmqpHostAndPort); LOGGER.info("Creating client"); JmsClient client = ResourceManager.getJmsClient("client-1", new JmsConnectionFactory(url)) - .withCredentials(Constants.ARTEMIS_INSTANCE_USER_NAME, Constants.ARTEMIS_INSTANCE_USER_PASS) + .withCredentials(ArtemisConstants.ADMIN_NAME, ArtemisConstants.ADMIN_PASS) .withDestination(Queue.class, queueName); LOGGER.info("Producing {} messages to queue {}", numOfMessages, queueName); diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/ha/sharedstore/FailoverSharedStoreTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/ha/sharedstore/FailoverSharedStoreTests.java index 637fc2b7..ef0b63c5 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/ha/sharedstore/FailoverSharedStoreTests.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/ha/sharedstore/FailoverSharedStoreTests.java @@ -6,6 +6,7 @@ import eu.rekawek.toxiproxy.Proxy; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; import io.brokerqe.claire.clients.DeployableClient; @@ -80,19 +81,19 @@ void setupEnv() { addressName = getTestRandomName(); Map senderOpts = new HashMap<>(Map.of( - "conn-username", Constants.ARTEMIS_INSTANCE_USER_NAME, - "conn-password", Constants.ARTEMIS_INSTANCE_USER_PASS, + "conn-username", ArtemisConstants.ADMIN_NAME, + "conn-password", ArtemisConstants.ADMIN_PASS, "address", addressName, "count", String.valueOf(SEND_CHUNK) )); Map receiverOpts = new HashMap<>(Map.of( - "conn-username", Constants.ARTEMIS_INSTANCE_USER_NAME, - "conn-password", Constants.ARTEMIS_INSTANCE_USER_PASS, + "conn-username", ArtemisConstants.ADMIN_NAME, + "conn-password", ArtemisConstants.ADMIN_PASS, "address", addressName, "count", String.valueOf(RECEIVE_CHUNK) )); - String primaryAmqpHostAndPort = artemisPrimary.getInstanceNameAndPort(ArtemisContainer.DEFAULT_ALL_PROTOCOLS_PORT); - String backupAmqpHostAndPort = artemisBackup.getInstanceNameAndPort(ArtemisContainer.DEFAULT_ALL_PROTOCOLS_PORT); + String primaryAmqpHostAndPort = artemisPrimary.getInstanceNameAndPort(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT); + String backupAmqpHostAndPort = artemisBackup.getInstanceNameAndPort(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT); primaryMessagingClient = new AmqpQpidClient(stDeployableClient, primaryAmqpHostAndPort, senderOpts, receiverOpts); backupMessagingClient = new AmqpQpidClient(stDeployableClient, backupAmqpHostAndPort, senderOpts, receiverOpts); } diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/helper/webconsole/LoginPageHelper.java b/standalone-suite/src/test/java/io/brokerqe/claire/helper/webconsole/LoginPageHelper.java index 9f8bb4a9..5f674667 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/helper/webconsole/LoginPageHelper.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/helper/webconsole/LoginPageHelper.java @@ -4,6 +4,7 @@ */ package io.brokerqe.claire.helper.webconsole; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.container.ArtemisContainer; import org.openqa.selenium.By; @@ -20,9 +21,9 @@ public class LoginPageHelper extends PageHelper { public static void login(RemoteWebDriver driver, ArtemisContainer artemisInstance) { WebElement username = driver.findElement(USERNAME_LOCATOR); - username.sendKeys(Constants.ARTEMIS_INSTANCE_USER_NAME); + username.sendKeys(ArtemisConstants.ADMIN_NAME); WebElement password = driver.findElement(PASSWORD_LOCATOR); - password.sendKeys(Constants.ARTEMIS_INSTANCE_USER_PASS); + password.sendKeys(ArtemisConstants.ADMIN_PASS); driver.findElement(LOGIN_BUTTON_LOCATOR).click(); MainPageHelper.waitMainPageToBeVisible(driver); diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/logging/audit/AuditLogTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/logging/audit/AuditLogTests.java new file mode 100644 index 00000000..9f535c73 --- /dev/null +++ b/standalone-suite/src/test/java/io/brokerqe/claire/logging/audit/AuditLogTests.java @@ -0,0 +1,301 @@ +/* + * Copyright Broker QE authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package io.brokerqe.claire.logging.audit; + +import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; +import io.brokerqe.claire.ResourceManager; +import io.brokerqe.claire.TestUtils; +import io.brokerqe.claire.client.deployment.BundledClientDeployment; +import io.brokerqe.claire.clients.MessagingClient; +import io.brokerqe.claire.clients.MessagingClientException; +import io.brokerqe.claire.clients.bundled.BundledAmqpMessagingClient; +import io.brokerqe.claire.clients.bundled.BundledClientOptions; +import io.brokerqe.claire.clients.bundled.BundledCoreMessagingClient; +import io.brokerqe.claire.container.ArtemisContainer; +import io.brokerqe.claire.helper.webconsole.LoginPageHelper; +import io.brokerqe.claire.helper.webconsole.MainPageHelper; +import io.brokerqe.claire.helper.webconsole.WebConsoleHelper; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.remote.RemoteWebDriver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.nio.file.Path; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class AuditLogTests extends AbstractSystemTests { + + private static final Logger LOGGER = LoggerFactory.getLogger(AuditLogTests.class); + + private ArtemisContainer artemisInstance; + private BundledClientDeployment artemisDeployableClient; + + @BeforeAll + void setupEnv() { + String artemisName = "artemis"; + LOGGER.info("Creating artemis instance: " + artemisName); + String tuneFile = generateYacfgProfilesContainerTestDir("tune.yaml.jinja2"); + artemisInstance = getArtemisInstance(artemisName, tuneFile); + artemisDeployableClient = new BundledClientDeployment(); + } + + @Test + void webConsoleLoginLogoutTest() { + // TODO: add parameters to test different browsers + // create a selenium remote web driver instance + RemoteWebDriver driver = ResourceManager.getChromeRemoteDriver("chrome-browser"); + + // load the console url (assertion is inside the method to be reused) + WebConsoleHelper.load(driver, artemisInstance); + + // try to log in (assertion is inside the method to be reused) + LoginPageHelper.login(driver, artemisInstance); + + // try to log out (assertion is inside the method to be reused) + MainPageHelper.logout(driver, artemisInstance); + + // assert the log does not contain the pattern + String logs = artemisInstance.getLogs(); + assertThat(logs).doesNotContainPattern(ArtemisConstants.LOG_PATTERN_FAILED_AUTH_304); + } + + @Test + void checkAuditLogsTest() { + String address = "myAddress"; + String queue = "myQueue"; + Path auditLogPath = Path.of(getTestConfigDir(), artemisInstance.getName(), ArtemisConstants.LOG_DIR, ArtemisConstants.AUDIT_LOG_FILE); + + String adminFormattedAuth = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN); + String adminFormattedAddress = String.format(ArtemisConstants.LOG_AUDIT_CREATE_ADDRESS_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN, address, queue); + String adminFormattedQueue = String.format(ArtemisConstants.LOG_AUDIT_CREATE_QUEUE_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN, queue, address); + String adminFormattedSent = String.format(ArtemisConstants.LOG_AUDIT_SENT_MESSAGE_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN, address, queue); + String adminFormattedRecv = String.format(ArtemisConstants.LOG_AUDIT_RECEIVED_MESSAGE_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN, queue); + + String charlieFormattedAuth = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN, ArtemisConstants.CHARLIE_NAME, ArtemisConstants.ROLE_SENDERS); + String charlieFormattedSent = String.format(ArtemisConstants.LOG_AUDIT_SENT_MESSAGE_PATTERN, ArtemisConstants.CHARLIE_NAME, ArtemisConstants.ROLE_SENDERS, address, queue); + String charlieFormattedRecv = String.format(ArtemisConstants.LOG_AUDIT_RECEIVED_MESSAGE_PATTERN, ArtemisConstants.CHARLIE_NAME, ArtemisConstants.ROLE_SENDERS, queue); + + String aliceFormattedAuth = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN, ArtemisConstants.ALICE_NAME, ArtemisConstants.ROLE_SENDERS); + String aliceFormattedSent = String.format(ArtemisConstants.LOG_AUDIT_SENT_MESSAGE_PATTERN, ArtemisConstants.ALICE_NAME, ArtemisConstants.ROLE_SENDERS, address, queue); + String aliceFormattedRecv = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_FAIL_CONSUME_PATTERN, ArtemisConstants.ALICE_NAME, ArtemisConstants.ROLE_SENDERS, ArtemisConstants.ALICE_NAME, queue, address); + + String bobFormattedAuth = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN, ArtemisConstants.BOB_NAME, ArtemisConstants.ROLE_RECEIVERS); + String bobFormattedSent = String.format(ArtemisConstants.LOG_AUDIT_RECEIVED_MESSAGE_PATTERN, ArtemisConstants.BOB_NAME, ArtemisConstants.ROLE_RECEIVERS, queue); + String bobFormattedRecv = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_FAIL_PRODUCE_PATTERN, ArtemisConstants.BOB_NAME, ArtemisConstants.ROLE_RECEIVERS, ArtemisConstants.BOB_NAME, address); + + LOGGER.info("Test Bundled Core Messaging"); + int msgsExpected = 5; + BundledClientOptions options = new BundledClientOptions() + .withDeployableClient(artemisDeployableClient) + .withDestinationAddress(address) + .withDestinationPort(DEFAULT_ALL_PORT) + .withMessageCount(msgsExpected) + .withPassword(ArtemisConstants.ADMIN_NAME) + .withUsername(ArtemisConstants.ADMIN_PASS) + .withDestinationQueue(queue) + .withDestinationUrl(artemisInstance.getName()); + MessagingClient bundledClient = new BundledCoreMessagingClient(options); + int sent = bundledClient.sendMessages(); + int received = bundledClient.receiveMessages(); + MatcherAssert.assertThat(sent, equalTo(msgsExpected)); + MatcherAssert.assertThat(received, equalTo(msgsExpected)); + + String auditLog = TestUtils.readFileContent(auditLogPath.toFile()); + LOGGER.warn("auditLog: {}", auditLog); + + assertThat(auditLog).containsPattern(adminFormattedAuth); + assertThat(auditLog).containsPattern(adminFormattedAddress); + assertThat(auditLog).containsPattern(adminFormattedQueue); + assertThat(auditLog).containsPattern(adminFormattedSent); + assertThat(auditLog).containsPattern(adminFormattedRecv); + + options = new BundledClientOptions() + .withDeployableClient(artemisDeployableClient) + .withDestinationAddress(address) + .withDestinationPort(DEFAULT_ALL_PORT) + .withMessageCount(msgsExpected) + .withPassword(ArtemisConstants.CHARLIE_NAME) + .withUsername(ArtemisConstants.CHARLIE_PASS) + .withDestinationQueue(queue) + .withDestinationUrl(artemisInstance.getName()); + bundledClient = new BundledCoreMessagingClient(options); + sent = bundledClient.sendMessages(); + received = bundledClient.receiveMessages(); + MatcherAssert.assertThat(sent, equalTo(msgsExpected)); + MatcherAssert.assertThat(received, equalTo(msgsExpected)); + + auditLog = TestUtils.readFileContent(auditLogPath.toFile()); + assertThat(auditLog).containsPattern(charlieFormattedAuth); + assertThat(auditLog).containsPattern(charlieFormattedSent); + assertThat(auditLog).containsPattern(charlieFormattedRecv); + + options = new BundledClientOptions() + .withDeployableClient(artemisDeployableClient) + .withDestinationAddress(address) + .withDestinationPort(DEFAULT_ALL_PORT) + .withMessageCount(msgsExpected) + .withPassword(ArtemisConstants.ALICE_NAME) + .withUsername(ArtemisConstants.ALICE_PASS) + .withDestinationQueue(queue) + .withDestinationUrl(artemisInstance.getName()); + BundledCoreMessagingClient bundledClientAlice = new BundledCoreMessagingClient(options); + int sentAlice = bundledClientAlice.sendMessages(); + assertThrows(MessagingClientException.class, bundledClientAlice::receiveMessages); + + auditLog = TestUtils.readFileContent(auditLogPath.toFile()); + LOGGER.warn("auditLog: {}", auditLog); + assertThat(auditLog).containsPattern(aliceFormattedAuth); + assertThat(auditLog).containsPattern(aliceFormattedSent); + assertThat(auditLog).containsPattern(aliceFormattedRecv); + + options = new BundledClientOptions() + .withDeployableClient(artemisDeployableClient) + .withDestinationAddress(address) + .withDestinationPort(DEFAULT_ALL_PORT) + .withMessageCount(msgsExpected) + .withPassword(ArtemisConstants.BOB_NAME) + .withUsername(ArtemisConstants.BOB_PASS) + .withDestinationQueue(queue) + .withDestinationUrl(artemisInstance.getName()); + BundledCoreMessagingClient bundledClientBob = new BundledCoreMessagingClient(options); + + assertThrows(MessagingClientException.class, bundledClientBob::sendMessages); + int receivedBob = bundledClientBob.receiveMessages(); + MatcherAssert.assertThat(sentAlice, equalTo(msgsExpected)); + MatcherAssert.assertThat(receivedBob, equalTo(msgsExpected)); + + auditLog = TestUtils.readFileContent(auditLogPath.toFile()); + LOGGER.warn("auditLog: {}", auditLog); + assertThat(auditLog).containsPattern(bobFormattedAuth); + assertThat(auditLog).containsPattern(bobFormattedSent); + assertThat(auditLog).containsPattern(bobFormattedRecv); + + deleteQueue(artemisDeployableClient, queue); + deleteAddress(artemisDeployableClient, address); + } + + @Test + @Disabled("Some AMQP discrepancy on user logging") + void checkAmqpAuditLogsTest() { + String address = "myAddress"; + String queue = "myQueue"; + Path auditLogPath = Path.of(getTestConfigDir(), artemisInstance.getName(), ArtemisConstants.LOG_DIR, ArtemisConstants.AUDIT_LOG_FILE); + String adminFormattedAuth = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN); + String adminFormattedAddress = String.format(ArtemisConstants.LOG_AUDIT_CREATE_ADDRESS_PATTERN_AMQP, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN, address, queue); + String adminFormattedQueue = String.format(ArtemisConstants.LOG_AUDIT_CREATE_QUEUE_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN, queue, address); + String adminFormattedSent = String.format(ArtemisConstants.LOG_AUDIT_SENT_MESSAGE_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN, address, queue); + String adminFormattedRecv = String.format(ArtemisConstants.LOG_AUDIT_RECEIVED_MESSAGE_PATTERN, ArtemisConstants.ADMIN_NAME, ArtemisConstants.ROLE_ADMIN, queue); + + String charlieFormattedAuth = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN, ArtemisConstants.CHARLIE_NAME, ArtemisConstants.ROLE_SENDERS); + String charlieFormattedSent = String.format(ArtemisConstants.LOG_AUDIT_SENT_MESSAGE_PATTERN, ArtemisConstants.CHARLIE_NAME, ArtemisConstants.ROLE_SENDERS, address, queue); + String charlieFormattedRecv = String.format(ArtemisConstants.LOG_AUDIT_RECEIVED_MESSAGE_PATTERN, ArtemisConstants.CHARLIE_NAME, ArtemisConstants.ROLE_SENDERS, queue); + + String aliceFormattedAuth = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN, ArtemisConstants.ALICE_NAME, ArtemisConstants.ROLE_SENDERS); + String aliceFormattedSent = String.format(ArtemisConstants.LOG_AUDIT_SENT_MESSAGE_PATTERN, ArtemisConstants.ALICE_NAME, ArtemisConstants.ROLE_SENDERS, address, queue); + String aliceFormattedRecv = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_FAIL_CONSUME_PATTERN, ArtemisConstants.ALICE_NAME, ArtemisConstants.ROLE_SENDERS, ArtemisConstants.ALICE_NAME, queue, address); + + String bobFormattedAuth = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_SUCC_PATTERN, ArtemisConstants.BOB_NAME, ArtemisConstants.ROLE_RECEIVERS); + String bobFormattedSent = String.format(ArtemisConstants.LOG_AUDIT_RECEIVED_MESSAGE_PATTERN, ArtemisConstants.BOB_NAME, ArtemisConstants.ROLE_RECEIVERS, queue); + String bobFormattedRecv = String.format(ArtemisConstants.LOG_AUDIT_AUTHENTICATION_FAIL_PRODUCE_PATTERN, ArtemisConstants.BOB_NAME, ArtemisConstants.ROLE_RECEIVERS, ArtemisConstants.BOB_NAME, address); + + LOGGER.info("Test Bundled Core Messaging"); + int msgsExpected = 5; + BundledClientOptions options = new BundledClientOptions() + .withDeployableClient(artemisDeployableClient) + .withDestinationAddress(address) + .withDestinationPort(DEFAULT_ALL_PORT) + .withMessageCount(msgsExpected) + .withPassword(ArtemisConstants.ADMIN_NAME) + .withUsername(ArtemisConstants.ADMIN_PASS) + .withDestinationQueue(queue) + .withDestinationUrl(artemisInstance.getName()); + MessagingClient bundledClient = new BundledAmqpMessagingClient(options); + int sent = bundledClient.sendMessages(); + int received = bundledClient.receiveMessages(); + MatcherAssert.assertThat(sent, equalTo(msgsExpected)); + MatcherAssert.assertThat(received, equalTo(msgsExpected)); + + String auditLog = TestUtils.readFileContent(auditLogPath.toFile()); + LOGGER.warn("auditLog: {}", auditLog); + // AMQ601262: User admin(amq)@192.168.32.2:34798 is creating address on target resource: 371c8f14-5e35-11ee-bfdb-0242c0a82002 with parameters: [Address [name=myAddress, id=0, routingTypes={ANYCAST}, autoCreated=false, paused=false, bindingRemovedTimestamp=-1, swept=false, createdTimestamp=1695929314633], true] + // ".* AMQ601262: User admin\(amq\)@.* is creating address on target resource: .* with parameters: \[myAddress::myQueue.*" + assertThat(auditLog).containsPattern(adminFormattedAuth); + assertThat(auditLog).containsPattern(adminFormattedAddress); + assertThat(auditLog).containsPattern(adminFormattedQueue); + assertThat(auditLog).containsPattern(adminFormattedSent); + assertThat(auditLog).containsPattern(adminFormattedRecv); + + options = new BundledClientOptions() + .withDeployableClient(artemisDeployableClient) + .withDestinationAddress(address) + .withDestinationPort(DEFAULT_ALL_PORT) + .withMessageCount(msgsExpected) + .withPassword(ArtemisConstants.CHARLIE_NAME) + .withUsername(ArtemisConstants.CHARLIE_PASS) + .withDestinationQueue(queue) + .withDestinationUrl(artemisInstance.getName()); + bundledClient = new BundledAmqpMessagingClient(options); + sent = bundledClient.sendMessages(); + received = bundledClient.receiveMessages(); + MatcherAssert.assertThat(sent, equalTo(msgsExpected)); + MatcherAssert.assertThat(received, equalTo(msgsExpected)); + + auditLog = TestUtils.readFileContent(auditLogPath.toFile()); + assertThat(auditLog).containsPattern(charlieFormattedAuth); + assertThat(auditLog).containsPattern(charlieFormattedSent); + assertThat(auditLog).containsPattern(charlieFormattedRecv); + + options = new BundledClientOptions() + .withDeployableClient(artemisDeployableClient) + .withDestinationAddress(address) + .withDestinationPort(DEFAULT_ALL_PORT) + .withMessageCount(msgsExpected) + .withPassword(ArtemisConstants.ALICE_NAME) + .withUsername(ArtemisConstants.ALICE_PASS) + .withDestinationQueue(queue) + .withDestinationUrl(artemisInstance.getName()); + BundledAmqpMessagingClient bundledClientAlice = new BundledAmqpMessagingClient(options); + int sentAlice = bundledClientAlice.sendMessages(); + assertThrows(MessagingClientException.class, bundledClientAlice::receiveMessages); + + auditLog = TestUtils.readFileContent(auditLogPath.toFile()); + LOGGER.warn("auditLog: {}", auditLog); + assertThat(auditLog).containsPattern(aliceFormattedAuth); + assertThat(auditLog).containsPattern(aliceFormattedSent); + assertThat(auditLog).containsPattern(aliceFormattedRecv); + + options = new BundledClientOptions() + .withDeployableClient(artemisDeployableClient) + .withDestinationAddress(address) + .withDestinationPort(DEFAULT_ALL_PORT) + .withMessageCount(msgsExpected) + .withPassword(ArtemisConstants.BOB_NAME) + .withUsername(ArtemisConstants.BOB_PASS) + .withDestinationQueue(queue) + .withDestinationUrl(artemisInstance.getName()); + BundledAmqpMessagingClient bundledClientBob = new BundledAmqpMessagingClient(options); + + assertThrows(MessagingClientException.class, bundledClientBob::sendMessages); + int receivedBob = bundledClientBob.receiveMessages(); + MatcherAssert.assertThat(sentAlice, equalTo(msgsExpected)); + MatcherAssert.assertThat(receivedBob, equalTo(msgsExpected)); + + auditLog = TestUtils.readFileContent(auditLogPath.toFile()); + LOGGER.warn("auditLog: {}", auditLog); + assertThat(auditLog).containsPattern(bobFormattedAuth); + assertThat(auditLog).containsPattern(bobFormattedSent); + assertThat(auditLog).containsPattern(bobFormattedRecv); + deleteQueue(artemisDeployableClient, queue); + deleteAddress(artemisDeployableClient, address); + } + +} diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/logging/audit/resource/LogAuditResourceTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/logging/audit/resource/LogAuditResourceTests.java deleted file mode 100644 index a2de8bc1..00000000 --- a/standalone-suite/src/test/java/io/brokerqe/claire/logging/audit/resource/LogAuditResourceTests.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright Broker QE authors. - * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). - */ -package io.brokerqe.claire.logging.audit.resource; - -import io.brokerqe.claire.AbstractSystemTests; -import io.brokerqe.claire.helper.webconsole.LoginPageHelper; -import io.brokerqe.claire.helper.webconsole.MainPageHelper; -import io.brokerqe.claire.helper.webconsole.WebConsoleHelper; -import io.brokerqe.claire.ResourceManager; -import io.brokerqe.claire.container.ArtemisContainer; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.openqa.selenium.remote.RemoteWebDriver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.assertj.core.api.Assertions.assertThat; - -public class LogAuditResourceTests extends AbstractSystemTests { - - private static final Logger LOGGER = LoggerFactory.getLogger(LogAuditResourceTests.class); - - private static final String LOG_PATTERN_FAILED_AUTH_304 = "AMQ601716: User .* failed authentication, reason: 304"; - - private ArtemisContainer artemisInstance; - - @BeforeAll - void setupEnv() { - String artemisName = "artemis"; - LOGGER.info("Creating artemis instance: " + artemisName); - String tuneFile = generateYacfgProfilesContainerTestDir("tune.yaml.jinja2"); - artemisInstance = getArtemisInstance(artemisName, tuneFile); - } - - @Test - void webConsoleLoginLogoutTest() { - // TODO: add parameters to test different browsers - // create a selenium remote web driver instance - RemoteWebDriver driver = ResourceManager.getChromeRemoteDriver("chrome-browser"); - - // load the console url (assertion is inside the method to be reused) - WebConsoleHelper.load(driver, artemisInstance); - - // try to log in (assertion is inside the method to be reused) - LoginPageHelper.login(driver, artemisInstance); - - // try to log out (assertion is inside the method to be reused) - MainPageHelper.logout(driver, artemisInstance); - - // assert the log does not contain the pattern - String logs = artemisInstance.getLogs(); - assertThat(logs).doesNotContainPattern(LOG_PATTERN_FAILED_AUTH_304); - } - -} diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/messaging/MessagingTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/messaging/MessagingTests.java index b1327f78..f74ec1c2 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/messaging/MessagingTests.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/messaging/MessagingTests.java @@ -5,6 +5,7 @@ package io.brokerqe.claire.messaging; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.Environment; import io.brokerqe.claire.TestUtils; @@ -47,8 +48,8 @@ public class MessagingTests extends AbstractSystemTests { private BundledClientDeployment artemisDeployableClient; private final String address = "lala"; private final String queue = "lala"; - private final String username = Constants.ARTEMIS_INSTANCE_USER_NAME; - private final String password = Constants.ARTEMIS_INSTANCE_USER_PASS; + private final String username = ArtemisConstants.ADMIN_NAME; + private final String password = ArtemisConstants.ADMIN_PASS; @BeforeAll void setupEnv() { diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/messaging/TransactionTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/messaging/TransactionTests.java index 8376e36d..4e077b20 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/messaging/TransactionTests.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/messaging/TransactionTests.java @@ -5,6 +5,7 @@ package io.brokerqe.claire.messaging; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.TestUtils; import io.brokerqe.claire.clients.DeployableClient; @@ -39,8 +40,8 @@ public class TransactionTests extends AbstractSystemTests { private static final Logger LOGGER = LoggerFactory.getLogger(TransactionTests.class); private ArtemisContainer artemis; private DeployableClient deployableClient; - private final String username = Constants.ARTEMIS_INSTANCE_USER_NAME; - private final String password = Constants.ARTEMIS_INSTANCE_USER_PASS; + private final String username = ArtemisConstants.ADMIN_NAME; + private final String password = ArtemisConstants.ADMIN_PASS; private String brokerUri; @BeforeAll diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/paging/MaxReadMessagesAndBytesTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/paging/MaxReadMessagesAndBytesTests.java index 8313766a..bf189cdd 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/paging/MaxReadMessagesAndBytesTests.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/paging/MaxReadMessagesAndBytesTests.java @@ -4,6 +4,7 @@ */ package io.brokerqe.claire.paging; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.AbstractSystemTests; @@ -49,12 +50,12 @@ void maxReadMessagesTest() { String queueName = "testPagingMaxReadMessagesAs10"; // create a qpid jms client - String artemisAmqpHostAndPort = artemisInstance.getHostAndPort(ArtemisContainer.DEFAULT_ALL_PROTOCOLS_PORT); + String artemisAmqpHostAndPort = artemisInstance.getHostAndPort(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT); String url = AmqpUtil.buildAmqpUrl(artemisAmqpHostAndPort); LOGGER.info("Creating client producer"); JmsClient client = ResourceManager.getJmsClient("client-1", new JmsConnectionFactory(url)) - .withCredentials(Constants.ARTEMIS_INSTANCE_USER_NAME, Constants.ARTEMIS_INSTANCE_USER_PASS) + .withCredentials(ArtemisConstants.ADMIN_NAME, ArtemisConstants.ADMIN_PASS) .withDestination(Queue.class, queueName); // specific message property @@ -127,12 +128,12 @@ void maxReadBytesTest() { String msgSelector = propKey + "='" + propValue + "'"; // create a qpid jms client - String artemisAmqpHostAndPort = artemisInstance.getHostAndPort(ArtemisContainer.DEFAULT_ALL_PROTOCOLS_PORT); + String artemisAmqpHostAndPort = artemisInstance.getHostAndPort(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT); String url = AmqpUtil.buildAmqpUrl(artemisAmqpHostAndPort); LOGGER.info("Creating client producer"); JmsClient client = ResourceManager.getJmsClient("client-1", new JmsConnectionFactory(url)) - .withCredentials(Constants.ARTEMIS_INSTANCE_USER_NAME, Constants.ARTEMIS_INSTANCE_USER_PASS) + .withCredentials(ArtemisConstants.ADMIN_NAME, ArtemisConstants.ADMIN_PASS) .withDestination(Queue.class, queueName); // produce 10 random message to generate a queue which will be paged diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/smoke/SingleInstanceSmokeTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/smoke/SingleInstanceSmokeTests.java index 8b805096..c7e0229d 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/smoke/SingleInstanceSmokeTests.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/smoke/SingleInstanceSmokeTests.java @@ -5,6 +5,7 @@ package io.brokerqe.claire.smoke; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; import io.brokerqe.claire.client.AmqpUtil; @@ -43,12 +44,12 @@ void queueProduceConsumeMsgTest() { String queueName = "TestQueue1"; LOGGER.info("Generating the client URL to connect to artemis instance"); - String artemisAmqpHostAndPort = artemisInstance.getHostAndPort(ArtemisContainer.DEFAULT_ALL_PROTOCOLS_PORT); + String artemisAmqpHostAndPort = artemisInstance.getHostAndPort(ArtemisConstants.DEFAULT_ALL_PROTOCOLS_PORT); String url = AmqpUtil.buildAmqpUrl(artemisAmqpHostAndPort); LOGGER.info("Creating client"); JmsClient client = ResourceManager.getJmsClient("client-1", new JmsConnectionFactory(url)) - .withCredentials(Constants.ARTEMIS_INSTANCE_USER_NAME, Constants.ARTEMIS_INSTANCE_USER_PASS) + .withCredentials(ArtemisConstants.ADMIN_NAME, ArtemisConstants.ADMIN_PASS) .withDestination(Queue.class, queueName); LOGGER.info("Producing {} messages to queue {}", numOfMessages, queueName); diff --git a/standalone-suite/src/test/java/io/brokerqe/claire/webconsole/SecuredConsoleTests.java b/standalone-suite/src/test/java/io/brokerqe/claire/webconsole/SecuredConsoleTests.java index e9733ff0..8afaf9c4 100644 --- a/standalone-suite/src/test/java/io/brokerqe/claire/webconsole/SecuredConsoleTests.java +++ b/standalone-suite/src/test/java/io/brokerqe/claire/webconsole/SecuredConsoleTests.java @@ -5,6 +5,7 @@ package io.brokerqe.claire.webconsole; import io.brokerqe.claire.AbstractSystemTests; +import io.brokerqe.claire.ArtemisConstants; import io.brokerqe.claire.ArtemisVersion; import io.brokerqe.claire.Constants; import io.brokerqe.claire.ResourceManager; @@ -73,7 +74,7 @@ void setupEnv() { """, keyStoreContainerPath, trustStoreContainerPath); TestUtils.createFile(tuneFileName, tuneFileContent); - artemis = ResourceManager.getArtemisContainerInstance(Constants.ARTEMIS_STRING); + artemis = ResourceManager.getArtemisContainerInstance(ArtemisConstants.ARTEMIS_STRING); artemis.withFileSystemBind(keystoreBrokerData.getKeyStorePath(), keyStoreContainerPath, BindMode.READ_WRITE); artemis.withFileSystemBind(truststoreBrokerData.getKeyStorePath(), trustStoreContainerPath, BindMode.READ_WRITE); generateArtemisCfg(artemis, new ArrayList<>(List.of("tune_file=" + tuneFileName))); diff --git a/standalone-suite/yacfg_profiles/claire-default-profile-2.21.0.yaml.jinja2 b/standalone-suite/yacfg_profiles/claire-default-profile-2.21.0.yaml.jinja2 index 0224e923..5952f9ce 100644 --- a/standalone-suite/yacfg_profiles/claire-default-profile-2.21.0.yaml.jinja2 +++ b/standalone-suite/yacfg_profiles/claire-default-profile-2.21.0.yaml.jinja2 @@ -32,6 +32,21 @@ _defaults: max_size_messages: -1 page_size_bytes: 10M + user_artemis_roles: + amq: + - admin + - lala + senders: + - alice + receivers: + - bob + + user_artemis_users: + admin: admin + alice: alice + bob: bob + lala: lala + render: generator_notice: true licenses: true @@ -65,7 +80,7 @@ broker_xml: {% include 'artemis/_modules/broker_xml/ha_policy/user_ha_policy.yaml.jinja2' %} -{% include 'artemis/_modules/users_roles_security/admin_broker_security_settings.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/gssapi_security_settings.yaml.jinja2' %} {% include 'artemis/_modules/broker_xml/address_settings/user_address_settings.yaml.jinja2' %} @@ -75,7 +90,7 @@ broker_xml: {% include 'artemis/_modules/artemis_profile/default_jmx.yaml.jinja2' %} # users and roles properties xml -{% include 'artemis/_modules/users_roles_security/admin.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/user_user_roles.yaml.jinja2' %} # bootstrap.xml {% include 'artemis/_modules/bootstrap_xml/allow.yaml.jinja2' %} diff --git a/standalone-suite/yacfg_profiles/claire-default-profile-2.28.0.yaml.jinja2 b/standalone-suite/yacfg_profiles/claire-default-profile-2.28.0.yaml.jinja2 index 898f2127..f32c760e 100644 --- a/standalone-suite/yacfg_profiles/claire-default-profile-2.28.0.yaml.jinja2 +++ b/standalone-suite/yacfg_profiles/claire-default-profile-2.28.0.yaml.jinja2 @@ -34,6 +34,23 @@ _defaults: max_read_page_messages: -1 max_read_page_bytes: 20M + user_artemis_roles: + amq: + - admin + senders: + - alice + - charlie + receivers: + - bob + - charlie + + user_artemis_users: + admin: admin + alice: alice + bob: bob + charlie: charlie + lala: lala + render: generator_notice: true licenses: true @@ -67,7 +84,7 @@ broker_xml: {% include 'artemis/_modules/broker_xml/ha_policy/user_ha_policy.yaml.jinja2' %} -{% include 'artemis/_modules/users_roles_security/admin_broker_security_settings.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/gssapi_security_settings.yaml.jinja2' %} {% include 'artemis/_modules/broker_xml/address_settings/user_address_settings.yaml.jinja2' %} @@ -77,7 +94,7 @@ broker_xml: {% include 'artemis/_modules/artemis_profile/default_jmx.yaml.jinja2' %} # users and roles properties xml -{% include 'artemis/_modules/users_roles_security/admin.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/user_user_roles.yaml.jinja2' %} # bootstrap.xml {% include 'artemis/_modules/bootstrap_xml/allow.yaml.jinja2' %} diff --git a/standalone-suite/yacfg_profiles/claire-default-profile-2.29.0.yaml.jinja2 b/standalone-suite/yacfg_profiles/claire-default-profile-2.29.0.yaml.jinja2 index 898f2127..e15180e8 100644 --- a/standalone-suite/yacfg_profiles/claire-default-profile-2.29.0.yaml.jinja2 +++ b/standalone-suite/yacfg_profiles/claire-default-profile-2.29.0.yaml.jinja2 @@ -34,6 +34,21 @@ _defaults: max_read_page_messages: -1 max_read_page_bytes: 20M + user_artemis_roles: + amq: + - admin + - lala + senders: + - alice + receivers: + - bob + + user_artemis_users: + admin: admin + alice: alice + bob: bob + lala: lala + render: generator_notice: true licenses: true @@ -67,7 +82,7 @@ broker_xml: {% include 'artemis/_modules/broker_xml/ha_policy/user_ha_policy.yaml.jinja2' %} -{% include 'artemis/_modules/users_roles_security/admin_broker_security_settings.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/gssapi_security_settings.yaml.jinja2' %} {% include 'artemis/_modules/broker_xml/address_settings/user_address_settings.yaml.jinja2' %} @@ -77,7 +92,7 @@ broker_xml: {% include 'artemis/_modules/artemis_profile/default_jmx.yaml.jinja2' %} # users and roles properties xml -{% include 'artemis/_modules/users_roles_security/admin.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/user_user_roles.yaml.jinja2' %} # bootstrap.xml {% include 'artemis/_modules/bootstrap_xml/allow.yaml.jinja2' %} diff --git a/standalone-suite/yacfg_profiles/claire-default-profile-2.30.0.yaml.jinja2 b/standalone-suite/yacfg_profiles/claire-default-profile-2.30.0.yaml.jinja2 index 898f2127..e15180e8 100644 --- a/standalone-suite/yacfg_profiles/claire-default-profile-2.30.0.yaml.jinja2 +++ b/standalone-suite/yacfg_profiles/claire-default-profile-2.30.0.yaml.jinja2 @@ -34,6 +34,21 @@ _defaults: max_read_page_messages: -1 max_read_page_bytes: 20M + user_artemis_roles: + amq: + - admin + - lala + senders: + - alice + receivers: + - bob + + user_artemis_users: + admin: admin + alice: alice + bob: bob + lala: lala + render: generator_notice: true licenses: true @@ -67,7 +82,7 @@ broker_xml: {% include 'artemis/_modules/broker_xml/ha_policy/user_ha_policy.yaml.jinja2' %} -{% include 'artemis/_modules/users_roles_security/admin_broker_security_settings.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/gssapi_security_settings.yaml.jinja2' %} {% include 'artemis/_modules/broker_xml/address_settings/user_address_settings.yaml.jinja2' %} @@ -77,7 +92,7 @@ broker_xml: {% include 'artemis/_modules/artemis_profile/default_jmx.yaml.jinja2' %} # users and roles properties xml -{% include 'artemis/_modules/users_roles_security/admin.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/user_user_roles.yaml.jinja2' %} # bootstrap.xml {% include 'artemis/_modules/bootstrap_xml/allow.yaml.jinja2' %} diff --git a/standalone-suite/yacfg_profiles/claire-default-profile-2.31.0.yaml.jinja2 b/standalone-suite/yacfg_profiles/claire-default-profile-2.31.0.yaml.jinja2 index 898f2127..e15180e8 100644 --- a/standalone-suite/yacfg_profiles/claire-default-profile-2.31.0.yaml.jinja2 +++ b/standalone-suite/yacfg_profiles/claire-default-profile-2.31.0.yaml.jinja2 @@ -34,6 +34,21 @@ _defaults: max_read_page_messages: -1 max_read_page_bytes: 20M + user_artemis_roles: + amq: + - admin + - lala + senders: + - alice + receivers: + - bob + + user_artemis_users: + admin: admin + alice: alice + bob: bob + lala: lala + render: generator_notice: true licenses: true @@ -67,7 +82,7 @@ broker_xml: {% include 'artemis/_modules/broker_xml/ha_policy/user_ha_policy.yaml.jinja2' %} -{% include 'artemis/_modules/users_roles_security/admin_broker_security_settings.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/gssapi_security_settings.yaml.jinja2' %} {% include 'artemis/_modules/broker_xml/address_settings/user_address_settings.yaml.jinja2' %} @@ -77,7 +92,7 @@ broker_xml: {% include 'artemis/_modules/artemis_profile/default_jmx.yaml.jinja2' %} # users and roles properties xml -{% include 'artemis/_modules/users_roles_security/admin.yaml.jinja2' %} +{% include 'artemis/_modules/users_roles_security/user_user_roles.yaml.jinja2' %} # bootstrap.xml {% include 'artemis/_modules/bootstrap_xml/allow.yaml.jinja2' %} diff --git a/standalone-suite/yacfg_profiles/tests/logging/audit/AuditLogTests/tune.yaml.jinja2 b/standalone-suite/yacfg_profiles/tests/logging/audit/AuditLogTests/tune.yaml.jinja2 new file mode 100644 index 00000000..cbf08a67 --- /dev/null +++ b/standalone-suite/yacfg_profiles/tests/logging/audit/AuditLogTests/tune.yaml.jinja2 @@ -0,0 +1,4 @@ +--- +log_level_audit_base: 'INFO, audit_log_file' +log_level_audit_message: 'INFO, audit_log_file' +log_level_audit_resource: 'INFO, audit_log_file' diff --git a/standalone-suite/yacfg_profiles/tests/logging/audit/resource/LogAuditResourceTests/tune.yaml.jinja2 b/standalone-suite/yacfg_profiles/tests/logging/audit/resource/LogAuditResourceTests/tune.yaml.jinja2 deleted file mode 100644 index e95a54b5..00000000 --- a/standalone-suite/yacfg_profiles/tests/logging/audit/resource/LogAuditResourceTests/tune.yaml.jinja2 +++ /dev/null @@ -1,2 +0,0 @@ ---- -log_level_audit_resource: 'INFO, audit_log_file'