@@ -2641,7 +2641,7 @@ - (void)doTestSubscriptionPoolWithSize:(NSInteger)subscriptionPoolSize deviceOnb
2641
2641
2642
2642
XCTAssertEqualObjects (controller.controllerNodeID , nodeID);
2643
2643
2644
- NSArray <NSNumber *> * orderedDeviceIDs = @[ @( 101 ), @( 102 ), @( 103 ), @( 104 ), @( 105 ) ];
2644
+ NSArray <NSNumber *> * orderedDeviceIDs = [deviceOnboardingPayloads allKeys ];
2645
2645
2646
2646
// Commission 5 devices
2647
2647
for (NSNumber * deviceID in orderedDeviceIDs) {
@@ -2669,21 +2669,16 @@ - (void)doTestSubscriptionPoolWithSize:(NSInteger)subscriptionPoolSize deviceOnb
2669
2669
2670
2670
// Set up expectations and delegates
2671
2671
2672
- NSDictionary <NSNumber *, XCTestExpectation *> * subscriptionExpectations = @{
2673
- @(101 ) : [self expectationWithDescription: @" Subscription 1 has been set up" ],
2674
- @(102 ) : [self expectationWithDescription: @" Subscription 2 has been set up" ],
2675
- @(103 ) : [self expectationWithDescription: @" Subscription 3 has been set up" ],
2676
- @(104 ) : [self expectationWithDescription: @" Subscription 4 has been set up" ],
2677
- @(105 ) : [self expectationWithDescription: @" Subscription 5 has been set up" ],
2678
- };
2672
+ NSMutableDictionary <NSNumber *, XCTestExpectation *> * subscriptionExpectations = [NSMutableDictionary dictionary ];
2673
+ for (NSNumber * deviceID in orderedDeviceIDs) {
2674
+ NSString * expectationDescription = [NSString stringWithFormat: @" Subscription 1 has been set up %@ " , deviceID];
2675
+ subscriptionExpectations[deviceID] = [self expectationWithDescription: expectationDescription];
2676
+ }
2679
2677
2680
- NSDictionary <NSNumber *, MTRDeviceTestDelegate *> * deviceDelegates = @{
2681
- @(101 ) : [[MTRDeviceTestDelegate alloc ] init ],
2682
- @(102 ) : [[MTRDeviceTestDelegate alloc ] init ],
2683
- @(103 ) : [[MTRDeviceTestDelegate alloc ] init ],
2684
- @(104 ) : [[MTRDeviceTestDelegate alloc ] init ],
2685
- @(105 ) : [[MTRDeviceTestDelegate alloc ] init ],
2686
- };
2678
+ NSMutableDictionary <NSNumber *, MTRDeviceTestDelegate *> * deviceDelegates = [NSMutableDictionary dictionary ];
2679
+ for (NSNumber * deviceID in orderedDeviceIDs) {
2680
+ deviceDelegates[deviceID] = [[MTRDeviceTestDelegate alloc ] init ];
2681
+ }
2687
2682
2688
2683
// Test with counters
2689
2684
__block os_unfair_lock counterLock = OS_UNFAIR_LOCK_INIT;
@@ -2786,6 +2781,74 @@ - (void)testSubscriptionPool
2786
2781
[self doTestSubscriptionPoolWithSize: 2 deviceOnboardingPayloads: deviceOnboardingPayloads];
2787
2782
}
2788
2783
2784
+ - (void )testSubscriptionPoolManyDevices
2785
+ {
2786
+ // QRCodes generated for discriminators 1111~1150 and passcodes 1001~1050
2787
+ NSDictionary <NSNumber *, NSString *> * deviceOnboardingPayloads = @{
2788
+ @(101 ) : @" MT:00000I9K17U0D900000" ,
2789
+ @(102 ) : @" MT:0000000000BED900000" ,
2790
+ @(103 ) : @" MT:000008C801TRD900000" ,
2791
+ @(104 ) : @" MT:00000GOG0293E900000" ,
2792
+ @(105 ) : @" MT:00000O-O03RGE900000" ,
2793
+ @(106 ) : @" MT:00000WAX047UE900000" ,
2794
+ @(107 ) : @" MT:000002N315P5F900000" ,
2795
+ @(108 ) : @" MT:00000AZB165JF900000" ,
2796
+ @(109 ) : @" MT:00000I9K17NWF900000" ,
2797
+ @(110 ) : @" MT:000000000048G900000" ,
2798
+ @(111 ) : @" MT:000008C801MLG900000" ,
2799
+ @(112 ) : @" MT:00000GOG022ZG900000" ,
2800
+ @(113 ) : @" MT:00000O-O03KAH900000" ,
2801
+ @(114 ) : @" MT:00000WAX040OH900000" ,
2802
+ @(115 ) : @" MT:000002N315I.H900000" ,
2803
+ @(116 ) : @" MT:00000AZB16-CI900000" ,
2804
+ @(117 ) : @" MT:00000I9K17GQI900000" ,
2805
+ @(118 ) : @" MT:0000000000Z1J900000" ,
2806
+ @(119 ) : @" MT:000008C801FFJ900000" ,
2807
+ @(120 ) : @" MT:00000GOG02XSJ900000" ,
2808
+ @(121 ) : @" MT:00000O-O03D4K900000" ,
2809
+ @(122 ) : @" MT:00000WAX04VHK900000" ,
2810
+ @(123 ) : @" MT:000002N315BVK900000" ,
2811
+ @(124 ) : @" MT:00000AZB16T6L900000" ,
2812
+ @(125 ) : @" MT:00000I9K179KL900000" ,
2813
+ @(126 ) : @" MT:0000000000SXL900000" ,
2814
+ @(127 ) : @" MT:000008C80189M900000" ,
2815
+ @(128 ) : @" MT:00000GOG02QMM900000" ,
2816
+ @(129 ) : @" MT:00000O-O036-M900000" ,
2817
+ @(130 ) : @" MT:00000WAX04OBN900000" ,
2818
+ @(131 ) : @" MT:000002N3154PN900000" ,
2819
+ @(132 ) : @" MT:00000AZB16M0O900000" ,
2820
+ @(133 ) : @" MT:00000I9K172EO900000" ,
2821
+ @(134 ) : @" MT:0000000000LRO900000" ,
2822
+ @(135 ) : @" MT:000008C80113P900000" ,
2823
+ @(136 ) : @" MT:00000GOG02JGP900000" ,
2824
+ @(137 ) : @" MT:00000O-O03.TP900000" ,
2825
+ @(138 ) : @" MT:00000WAX04H5Q900000" ,
2826
+ @(139 ) : @" MT:000002N315ZIQ900000" ,
2827
+ @(140 ) : @" MT:00000AZB16FWQ900000" ,
2828
+ @(141 ) : @" MT:00000I9K17X7R900000" ,
2829
+ @(142 ) : @" MT:0000000000ELR900000" ,
2830
+ @(143 ) : @" MT:000008C801WYR900000" ,
2831
+ @(144 ) : @" MT:00000GOG02CAS900000" ,
2832
+ @(145 ) : @" MT:00000O-O03UNS900000" ,
2833
+ @(146 ) : @" MT:00000WAX04A.S900000" ,
2834
+ @(147 ) : @" MT:000002N315SCT900000" ,
2835
+ @(148 ) : @" MT:00000AZB168QT900000" ,
2836
+ @(149 ) : @" MT:00000I9K17Q1U900000" ,
2837
+ @(150 ) : @" MT:00000000007FU900000" ,
2838
+ };
2839
+
2840
+ // Start our helper apps.
2841
+ __auto_type * sortedKeys = [[deviceOnboardingPayloads allKeys ] sortedArrayUsingSelector: @selector (compare: )];
2842
+ for (NSNumber * deviceID in sortedKeys) {
2843
+ BOOL started = [self startAppWithName: @" all-clusters"
2844
+ arguments: @[]
2845
+ payload: deviceOnboardingPayloads[deviceID]];
2846
+ XCTAssertTrue (started);
2847
+ }
2848
+
2849
+ [self doTestSubscriptionPoolWithSize: 3 deviceOnboardingPayloads: deviceOnboardingPayloads];
2850
+ }
2851
+
2789
2852
- (MTRDevice *)getMTRDevice : (NSNumber *)deviceID
2790
2853
{
2791
2854
__auto_type * factory = [MTRDeviceControllerFactory sharedInstance ];
0 commit comments