Skip to content

Commit 03d4a2e

Browse files
Merge pull request #225 from oracle/WDT-58-quota-mbean-setter-method-missing
Wdt 58 quota mbean setter method missing
2 parents 1bec63f + 5e11a45 commit 03d4a2e

File tree

4 files changed

+50
-12
lines changed

4 files changed

+50
-12
lines changed

core/src/main/python/wlsdeploy/tool/util/attribute_setter.py

+15
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from wlsdeploy.aliases.model_constants import PARTITION_WORK_MANAGER
4646
from wlsdeploy.aliases.model_constants import PERSISTENT_STORE
4747
from wlsdeploy.aliases.model_constants import QUEUE
48+
from wlsdeploy.aliases.model_constants import QUOTA
4849
from wlsdeploy.aliases.model_constants import REALM
4950
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP
5051
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP_TEMPLATE
@@ -415,6 +416,20 @@ def set_jms_server_mbean(self, location, key, value, wlst_value):
415416
self.set_attribute(location, key, mbean, wlst_merge_value=wlst_value, use_raw_value=True)
416417
return
417418

419+
def set_jms_quota_mbean(self, location, key, value, wlst_value):
420+
"""
421+
For those entities, queues, template, topics, that take a single Quota mbean.
422+
:param location: location to look for Quota mbean
423+
:param key: the attribute name
424+
:param value: the string value
425+
:param wlst_value: the existing value of the attribute from WLST
426+
:raises BundleAwareException of the specified type: if quota mbean is not found.
427+
"""
428+
resource_location = self.__get_parent_location(location, JMS_RESOURCE)
429+
mbean = self.__find_in_location(resource_location, QUOTA, value, required=True)
430+
self.set_attribute(location, key, mbean, wlst_merge_value=wlst_value, use_raw_value=True)
431+
return
432+
418433
def set_reliable_delivery_policy_mbean(self, location, key, value, wlst_value):
419434
"""
420435
Sets the ws soap reliable delivery policy mbean used by mbeans like Server and Server Template.

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/JMSSystemResource.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@
431431
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
432432
"PersistentQos": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PersistentQos", "wlst_path": "WP001", "value": {"default": "Exactly-Once" }, "wlst_type": "string", "get_method": "LSA"} ],
433433
"RemoteJndiName": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Remote${Jndi:JNDI}Name", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA"} ],
434-
"SAFErrorHandling": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SAFErrorHandling", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_saf_error_handling_mbean", "set_mbean_type": "weblogic.j2ee.descriptor.wl.SAFErrorHandlingBean", "restart_required": "true" } ],
434+
"SAFErrorHandling": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SAFErrorHandling", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_saf_error_destination_mbean", "set_mbean_type": "weblogic.j2ee.descriptor.wl.SAFErrorHandlingBean", "restart_required": "true" } ],
435435
"TimeToLiveDefault": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "TimeToLiveDefault", "wlst_path": "WP001", "value": {"default": "${0:3600000}" }, "wlst_type": "long" } ],
436436
"UnitOfOrderRouting": [ {"version": "[10,12.2.1.2)", "wlst_mode": "both", "wlst_name": "UnitOfOrderRouting", "wlst_path": "WP001", "value": {"default": "Hash" }, "wlst_type": "string", "get_method": "LSA", "restart_required": "true"} ,
437437
{"version": "[12.2.1.2,)", "wlst_mode": "both", "wlst_name": "UnitOfOrderRouting", "wlst_path": "WP001", "value": {"default": "${None:Hash}" }, "wlst_type": "string", "get_method": "LSA", "restart_required": "true"} ],
@@ -465,7 +465,7 @@
465465
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
466466
"PersistentQos": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PersistentQos", "wlst_path": "WP001", "value": {"default": "Exactly-Once" }, "wlst_type": "string" } ],
467467
"RemoteJndiName": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Remote${Jndi:JNDI}Name", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA"} ],
468-
"SAFErrorHandling": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SAFErrorHandling", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_saf_error_handling_mbean", "set_mbean_type": "weblogic.j2ee.descriptor.wl.SAFErrorHandlingBean", "restart_required": "true"} ],
468+
"SAFErrorHandling": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SAFErrorHandling", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_saf_error_destination_mbean", "set_mbean_type": "weblogic.j2ee.descriptor.wl.SAFErrorHandlingBean", "restart_required": "true"} ],
469469
"TimeToLiveDefault": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "TimeToLiveDefault", "wlst_path": "WP001", "value": {"default": "${0:3600000}" }, "wlst_type": "long" } ],
470470
"UnitOfOrderRouting": [ {"version": "[10,12.2.1.2)", "wlst_mode": "both", "wlst_name": "UnitOfOrderRouting", "wlst_path": "WP001", "value": {"default": "Hash" }, "wlst_type": "string", "restart_required": "true" } ,
471471
{"version": "[12.2.1.2,)", "wlst_mode": "both", "wlst_name": "UnitOfOrderRouting", "wlst_path": "WP001", "value": {"default": "${None:Hash}" }, "wlst_type": "string", "restart_required": "true" } ],
@@ -493,7 +493,7 @@
493493
"DefaultTargetingEnabled": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DefaultTargetingEnabled", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "boolean", "restart_required": "true"} ],
494494
"JNDIPrefix": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "JNDIPrefix", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
495495
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
496-
"SAFErrorHandling": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SAFErrorHandling", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_saf_error_handling_mbean", "set_mbean_type": "weblogic.j2ee.descriptor.wl.SAFErrorHandlingBean", "restart_required": "true" } ],
496+
"SAFErrorHandling": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SAFErrorHandling", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_saf_error_destination_mbean", "set_mbean_type": "weblogic.j2ee.descriptor.wl.SAFErrorHandlingBean", "restart_required": "true" } ],
497497
"SAFRemoteContext": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SAFRemoteContext", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_saf_remote_context_mbean", "set_mbean_type": "weblogic.j2ee.descriptor.wl.SAFRemoteContextBean"} ],
498498
"SubDeploymentName": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SubDeploymentName", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "restart_required": "true" } ],
499499
"TimeToLiveDefault": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "TimeToLiveDefault", "wlst_path": "WP001", "value": {"default": "${0:3600000}" }, "wlst_type": "long" } ],

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

+1
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ WLSDPLY-09404=Failed to create directory for FileStore {0} at location {1}
882882
# wlsdeploy/tool/deploy/jms_resources_deployer.py
883883
WLSDPLY-09500=Creating placeholder for Template {0}
884884
WLSDPLY-09501=Skipping {0} for {1} {2}
885+
WLSDPLY-09502=Creating placeholder for Quota {0}
885886

886887
# wlsdeploy/tool/deploy/log_helper.py
887888
WLSDPLY-09600=Adding {0}

core/src/test/python/alias_json_file_test.py

+31-9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
from wlsdeploy.aliases.alias_constants import WLST_SUBFOLDERS_PATH
5050
from wlsdeploy.aliases.alias_constants import WLST_TYPE
5151

52+
from wlsdeploy.exception.expection_types import ExceptionType
53+
from wlsdeploy.tool.util.attribute_setter import AttributeSetter
5254

5355
class ListTestCase(unittest.TestCase):
5456
_resources_dir = '../../test-classes/'
@@ -496,18 +498,33 @@ def _verify_attribute_set_method_attribute_value(self, folder_name, attribute_na
496498
SET_METHOD, alias_attribute_value)
497499
result.append(message)
498500
else:
499-
offline_value = self.alias_entries._resolve_curly_braces(alias_attribute_value)
500-
if len(offline_value) > 0 and not offline_value.startswith('MBEAN'):
501-
message = self._get_invalid_alias_attribute_value_message(folder_name, attribute_name, SET_METHOD,
502-
'offline', offline_value,
503-
'it does not start with MBEAN')
504-
result.append(message)
505-
online_value = self.alias_entries._resolve_curly_braces(alias_attribute_value)
506-
if offline_value != online_value and len(online_value) > 0 and not online_value.startswith('MBEAN'):
501+
result.extend(self._verify_attribute_set_method(folder_name, attribute_name, WlstModes.OFFLINE,
502+
alias_attribute_value, self.alias_entries))
503+
result.extend(self._verify_attribute_set_method(folder_name, attribute_name, WlstModes.ONLINE,
504+
alias_attribute_value, self.online_alias_entries))
505+
return result
506+
507+
def _verify_attribute_set_method(self, folder_name, attribute_name, wlst_mode, attribute_value, aliases):
508+
result = []
509+
resolved_attribute = aliases._resolve_curly_braces(attribute_value)
510+
if resolved_attribute:
511+
if not resolved_attribute.startswith('MBEAN'):
507512
message = self._get_invalid_alias_attribute_value_message(folder_name, attribute_name, SET_METHOD,
508-
'online', online_value,
513+
WlstModes.from_value(wlst_mode),
514+
resolved_attribute,
509515
'it does not start with MBEAN')
510516
result.append(message)
517+
else:
518+
set_method_value_components = resolved_attribute.split('.')
519+
if len(set_method_value_components) == 2:
520+
invoker = set_method_value_components[1]
521+
522+
instance = AttributeSetter(aliases, None, ExceptionType.ALIAS, wlst_mode)
523+
try:
524+
getattr(instance, invoker)
525+
except AttributeError:
526+
result.append(self.set_method_not_found_message(folder_name, attribute_name,
527+
WlstModes.from_value(wlst_mode), invoker))
511528
return result
512529

513530
def _verify_attribute_uses_path_tokens_attribute_value(self, folder_name, attribute_name, alias_attribute_value):
@@ -750,3 +767,8 @@ def _get_invalid_alias_attribute_value_message(self, folder_name, attribute_name
750767
text = 'Folder at path %s has a defined attribute %s with alias attribute %s whose ' \
751768
'%s value %s was not valid because %s'
752769
return text % (folder_name, attribute_name, alias_attribute_name, wlst_mode, alias_attribute_value, cause)
770+
771+
def set_method_not_found_message(self, folder_name, attribute_name, wlst_mode, alias_attribute_value):
772+
text = 'Folder at path %s has a %s defined attribute %s whose set_method %s was not found in the' \
773+
' attribute setter class'
774+
return text % (folder_name, attribute_name, wlst_mode, alias_attribute_value)

0 commit comments

Comments
 (0)