@@ -957,5 +957,144 @@ def _assertMapEqual(self, expected, testObject):
957
957
self .assertEqual (expected .get (key ), testObject .get (str (key ).strip ()))
958
958
return
959
959
960
+ def testIssue36Fix (self ):
961
+ base_location = LocationContext ().append_location (FOLDERS .RESOURCE_MANAGER )
962
+ token = self .aliases .get_name_token (base_location )
963
+ base_location .add_name_token (token , 'ResourceManager-0' )
964
+
965
+ location = LocationContext (base_location ).append_location (FOLDERS .CPU_UTILIZATION )
966
+ token = self .aliases .get_name_token (location )
967
+ location .add_name_token (token , 'CpuUtilization-0' )
968
+ location .append_location (FOLDERS .TRIGGER )
969
+ token = self .aliases .get_name_token (location )
970
+ location .add_name_token (token , 'Trigger-0' )
971
+
972
+ expected = [FOLDERS .TRIGGER , '%ss' % FOLDERS .TRIGGER ]
973
+
974
+ wlst_mbean_type = self .aliases .get_wlst_mbean_type (location )
975
+ self .assertEqual (wlst_mbean_type , expected [0 ])
976
+
977
+ wlst_mbean_type = self .online_aliases .get_wlst_mbean_type (location )
978
+ self .assertEqual (wlst_mbean_type , expected [1 ])
979
+
980
+ location = LocationContext (base_location ).append_location (FOLDERS .FILE_OPEN )
981
+ token = self .aliases .get_name_token (location )
982
+ location .add_name_token (token , 'FileOpen-0' )
983
+ location .append_location (FOLDERS .TRIGGER )
984
+ token = self .aliases .get_name_token (location )
985
+ location .add_name_token (token , 'Trigger-0' )
986
+
987
+ wlst_mbean_type = self .aliases .get_wlst_mbean_type (location )
988
+ self .assertEqual (wlst_mbean_type , expected [0 ])
989
+
990
+ wlst_mbean_type = self .online_aliases .get_wlst_mbean_type (location )
991
+ self .assertEqual (wlst_mbean_type , expected [1 ])
992
+
993
+ location = LocationContext (base_location ).append_location (FOLDERS .HEAP_RETAINED )
994
+ token = self .aliases .get_name_token (location )
995
+ location .add_name_token (token , 'HeapRetained-0' )
996
+ location .append_location (FOLDERS .TRIGGER )
997
+ token = self .aliases .get_name_token (location )
998
+ location .add_name_token (token , 'Trigger-0' )
999
+
1000
+ wlst_mbean_type = self .aliases .get_wlst_mbean_type (location )
1001
+ self .assertEqual (wlst_mbean_type , expected [0 ])
1002
+
1003
+ wlst_mbean_type = self .online_aliases .get_wlst_mbean_type (location )
1004
+ self .assertEqual (wlst_mbean_type , expected [1 ])
1005
+
1006
+ return
1007
+
1008
+ def testIssue37Fix (self ):
1009
+ location = LocationContext ().append_location (FOLDERS .WLDF_SYSTEM_RESOURCE )
1010
+ token = self .aliases .get_name_token (location )
1011
+ location .add_name_token (token , 'WLDFSystemResource-0' )
1012
+ location .append_location (FOLDERS .WLDF_RESOURCE )
1013
+ location .append_location (FOLDERS .WATCH_NOTIFICATION )
1014
+ token = self .aliases .get_name_token (location )
1015
+ location .add_name_token (token , 'WatchNotification-0' )
1016
+ location .append_location (FOLDERS .HEAP_DUMP_ACTION )
1017
+ token = self .aliases .get_name_token (location )
1018
+ location .add_name_token (token , 'HeapDumpAction-0' )
1019
+
1020
+ wlst_mbean_type = self .aliases .get_wlst_mbean_type (location )
1021
+ expected = FOLDERS .HEAP_DUMP_ACTION
1022
+ self .assertEqual (wlst_mbean_type , expected )
1023
+
1024
+ wlst_mbean_type = self .online_aliases .get_wlst_mbean_type (location )
1025
+ expected = '%ss' % FOLDERS .HEAP_DUMP_ACTION
1026
+ self .assertEqual (wlst_mbean_type , expected )
1027
+
1028
+ return
1029
+
1030
+ def testIssue38Fix (self ):
1031
+ location = LocationContext ().append_location (FOLDERS .PARTITION )
1032
+ token = self .aliases .get_name_token (location )
1033
+ location .add_name_token (token , 'Partition-0' )
1034
+
1035
+ # Check offline value of wlst_mbean_type of FOLDERS.PARTITION
1036
+ wlst_mbean_type = self .aliases .get_wlst_mbean_type (location )
1037
+ expected = FOLDERS .PARTITION
1038
+ self .assertEqual (wlst_mbean_type , expected )
1039
+
1040
+ # Check online value of wlst_mbean_type of FOLDERS.PARTITION.
1041
+ # There should be an 's' on the end of FOLDERS.PARTITION
1042
+ wlst_mbean_type = self .online_aliases .get_wlst_mbean_type (location )
1043
+ expected = '%ss' % FOLDERS .PARTITION
1044
+ self .assertEqual (wlst_mbean_type , expected )
1045
+
1046
+ # Add FOLDERS.PARTITION_WORK_MANAGER to the location
1047
+ location .append_location (FOLDERS .PARTITION_WORK_MANAGER )
1048
+ token = self .aliases .get_name_token (location )
1049
+ location .add_name_token (token , 'PartitionWorkManager-0' )
1050
+
1051
+ # Check offline value of wlst_mbean_type after adding
1052
+ # FOLDERS.PARTITION_WORK_MANAGER to the location. There
1053
+ # should not be an 's' on the end of FOLDERS.PARTITION_WORK_MANAGER
1054
+ wlst_mbean_type = self .aliases .get_wlst_mbean_type (location )
1055
+ expected = FOLDERS .PARTITION_WORK_MANAGER
1056
+ self .assertEqual (wlst_mbean_type , expected )
1057
+
1058
+ # Check online value of wlst_mbean_type after adding
1059
+ # FOLDERS.PARTITION_WORK_MANAGER to the location. It
1060
+ # should be the same value as offline; no 's' on the
1061
+ # end of FOLDERS.PARTITION_WORK_MANAGER
1062
+ wlst_mbean_type = self .online_aliases .get_wlst_mbean_type (location )
1063
+ self .assertEqual (wlst_mbean_type , expected )
1064
+
1065
+ # Check offline value of wlst_list_path after adding
1066
+ # FOLDERS.PARTITION_WORK_MANAGER to the location. There
1067
+ # should not be an 's' on the end of FOLDERS.PARTITION or
1068
+ # FOLDERS.PARTITION_WORK_MANAGER
1069
+ expected = [FOLDERS .PARTITION , 'Partition-0' , FOLDERS .PARTITION_WORK_MANAGER ]
1070
+ wlst_list_path = self .aliases .get_wlst_list_path (location )
1071
+ self .assertEqual (wlst_list_path , '/%s' % '/' .join (expected ))
1072
+
1073
+ # Check online value of wlst_list_path after adding
1074
+ # FOLDERS.PARTITION_WORK_MANAGER to the location. There
1075
+ # should be an 's' on the end of FOLDERS.PARTITION, but
1076
+ # not on the end of FOLDERS.PARTITION_WORK_MANAGER
1077
+ expected = ['%ss' % FOLDERS .PARTITION , 'Partition-0' , FOLDERS .PARTITION_WORK_MANAGER ]
1078
+ wlst_list_path = self .online_aliases .get_wlst_list_path (location )
1079
+ self .assertEqual (wlst_list_path , '/%s' % '/' .join (expected ))
1080
+
1081
+ # Check offline value of wlst_subfolders_path after adding
1082
+ # FOLDERS.PARTITION_WORK_MANAGER to the location. There
1083
+ # should be an 's' on the end of FOLDERS.PARTITION, but
1084
+ # not on the end of FOLDERS.PARTITION_WORK_MANAGER
1085
+ expected = [FOLDERS .PARTITION , 'Partition-0' , FOLDERS .PARTITION_WORK_MANAGER , 'PartitionWorkManager-0' ]
1086
+ wlst_subfolders_path = self .aliases .get_wlst_subfolders_path (location )
1087
+ self .assertEqual (wlst_subfolders_path , '/%s' % '/' .join (expected ))
1088
+
1089
+ # Check online value of wlst_subfolders_path after adding
1090
+ # FOLDERS.PARTITION_WORK_MANAGER to the location. There
1091
+ # should be an 's' on the end of FOLDERS.PARTITION, but
1092
+ # not on the end of FOLDERS.PARTITION_WORK_MANAGER
1093
+ expected = ['%ss' % FOLDERS .PARTITION , 'Partition-0' , FOLDERS .PARTITION_WORK_MANAGER , 'PartitionWorkManager-0' ]
1094
+ wlst_subfolders_path = self .online_aliases .get_wlst_subfolders_path (location )
1095
+ self .assertEqual (wlst_subfolders_path , '/%s' % '/' .join (expected ))
1096
+
1097
+ return
1098
+
960
1099
if __name__ == '__main__' :
961
1100
unittest .main ()
0 commit comments