]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Use TestBed.inject instead of TestBed.get
authorTiago Melo <tmelo@suse.com>
Wed, 6 May 2020 17:50:43 +0000 (17:50 +0000)
committerTiago Melo <tmelo@suse.com>
Wed, 3 Jun 2020 09:10:30 +0000 (09:10 +0000)
This new method has the same behavior, but is type safe.

Fixes: https://tracker.ceph.com/issues/45326
Signed-off-by: Tiago Melo <tmelo@suse.com>
124 files changed:
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/pg-category.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/auth.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/health.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/iscsi.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/logging.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/logs.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/mgr-module.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/performance-counter.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-site.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/role.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/scope.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/settings.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/telemetry.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/user.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/config-option/config-option.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/pwd-expiration-notification/pwd-expiration-notification.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/change-password-guard.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/dep-checker.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/device.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/language.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/no-sso-guard.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/summary.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/text-to-download.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/time-diff.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/timer.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/testing/activated-route-stub.ts

index 2f232513bed8a7db3fd5ed985da255d6b334c580..6d867cad0e096b60131a1eb35ffc0d8f57d1a25c 100644 (file)
@@ -45,7 +45,7 @@ describe('IscsiTargetDiscoveryModalComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(IscsiTargetDiscoveryModalComponent);
     component = fixture.componentInstance;
-    httpTesting = TestBed.get(HttpTestingController);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   describe('with update permissions', () => {
index 6fa48af6ec4a2b7bb6ec66bcef5d5c2f72ec5e9f..1e99f242d781a3afec961979441f338f4ca9edb1 100644 (file)
@@ -162,8 +162,8 @@ describe('IscsiTargetFormComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(IscsiTargetFormComponent);
     component = fixture.componentInstance;
-    httpTesting = TestBed.get(HttpTestingController);
-    activatedRoute = TestBed.get(ActivatedRoute);
+    httpTesting = TestBed.inject(HttpTestingController);
+    activatedRoute = <ActivatedRouteStub>TestBed.inject(ActivatedRoute);
     fixture.detectChanges();
 
     httpTesting.expectOne('ui-api/iscsi/settings').flush(SETTINGS);
index 50d636febe5c69fc5969fe6f52a1d83eda12ac5a..d0afb205289d6658f36302638f5ebfbac1d59bc8 100644 (file)
@@ -51,8 +51,8 @@ describe('IscsiTargetListComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(IscsiTargetListComponent);
     component = fixture.componentInstance;
-    summaryService = TestBed.get(SummaryService);
-    iscsiService = TestBed.get(IscsiService);
+    summaryService = TestBed.inject(SummaryService);
+    iscsiService = TestBed.inject(IscsiService);
 
     // this is needed because summaryService isn't being reset after each test.
     summaryService['summaryDataSource'] = new BehaviorSubject(null);
index b693c3d45f3678eb09e5d6c3cae562cbdbe72318..7b091c0179218bad7d0571f4f1645e8c85c0785e 100644 (file)
@@ -46,7 +46,7 @@ describe('IscsiComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(IscsiComponent);
     component = fixture.componentInstance;
-    iscsiService = TestBed.get(IscsiService);
+    iscsiService = TestBed.inject(IscsiService);
     fixture.detectChanges();
     tcmuiscsiData = {
       images: []
index eb288af8854444089dfc6505ef5ce1640028ad56..cd27bf29081fec921348f502fe22b728f033f83b 100644 (file)
@@ -41,10 +41,10 @@ describe('BootstrapCreateModalComponent', () => {
     component = fixture.componentInstance;
     component.siteName = 'site-A';
 
-    notificationService = TestBed.get(NotificationService);
+    notificationService = TestBed.inject(NotificationService);
     spyOn(notificationService, 'show').and.stub();
 
-    rbdMirroringService = TestBed.get(RbdMirroringService);
+    rbdMirroringService = TestBed.inject(RbdMirroringService);
 
     formHelper = new FormHelper(component.createBootstrapForm);
 
index b9fa7d846ea88402c48fb94e38e4b12b477fcab0..e5a37603d324c8e242f4813144ffbe1bfb35bbdf 100644 (file)
@@ -41,10 +41,10 @@ describe('BootstrapImportModalComponent', () => {
     component = fixture.componentInstance;
     component.siteName = 'site-A';
 
-    notificationService = TestBed.get(NotificationService);
+    notificationService = TestBed.inject(NotificationService);
     spyOn(notificationService, 'show').and.stub();
 
-    rbdMirroringService = TestBed.get(RbdMirroringService);
+    rbdMirroringService = TestBed.inject(RbdMirroringService);
 
     formHelper = new FormHelper(component.importBootstrapForm);
 
index 227964ac2c6fb6f864070b29f470929f75e8f5f5..05b93a6ae87b12cd9839f66648b2e8e2db596969 100644 (file)
@@ -36,10 +36,10 @@ describe('EditSiteNameModalComponent', () => {
     component = fixture.componentInstance;
     component.siteName = 'site-A';
 
-    notificationService = TestBed.get(NotificationService);
+    notificationService = TestBed.inject(NotificationService);
     spyOn(notificationService, 'show').and.stub();
 
-    rbdMirroringService = TestBed.get(RbdMirroringService);
+    rbdMirroringService = TestBed.inject(RbdMirroringService);
   });
 
   it('should create', () => {
index 5d3af10a417a24ee2fca6ab26f9962ed1ba45a31..45e321d152fb75c12a51797dea8625f50d47e224 100644 (file)
@@ -41,10 +41,10 @@ describe('PoolEditModeModalComponent', () => {
     component = fixture.componentInstance;
     component.poolName = 'somePool';
 
-    notificationService = TestBed.get(NotificationService);
+    notificationService = TestBed.inject(NotificationService);
     spyOn(notificationService, 'show').and.stub();
 
-    rbdMirroringService = TestBed.get(RbdMirroringService);
+    rbdMirroringService = TestBed.inject(RbdMirroringService);
 
     formHelper = new FormHelper(component.editModeForm);
     fixture.detectChanges();
index 6353ce89765b4781181a5013a460be02efb70479..7cd8e5fb3a8d29dbf25cf316686ca4bf7f1345c1 100644 (file)
@@ -43,10 +43,10 @@ describe('PoolEditPeerModalComponent', () => {
     component.mode = 'add';
     component.poolName = 'somePool';
 
-    notificationService = TestBed.get(NotificationService);
+    notificationService = TestBed.inject(NotificationService);
     spyOn(notificationService, 'show').and.stub();
 
-    rbdMirroringService = TestBed.get(RbdMirroringService);
+    rbdMirroringService = TestBed.inject(RbdMirroringService);
 
     formHelper = new FormHelper(component.editPeerForm);
   });
index 60926a043ed520d432e6419eeec3068d6b758220..ebffe8a5a8c94ce9273072ada64fc6ef35cec08f 100644 (file)
@@ -43,7 +43,7 @@ describe('RbdConfigurationFormComponent', () => {
     component.form = new CdFormGroup({}, null);
     fh = new FormHelper(component.form);
     fixture.detectChanges();
-    sections = TestBed.get(RbdConfigurationService).sections;
+    sections = TestBed.inject(RbdConfigurationService).sections;
   });
 
   it('should create', () => {
index b19b50776a76630b5d687dae53911ed5cc1f0928..31a984079a86d24385592707353ca9d13221e181 100644 (file)
@@ -52,7 +52,7 @@ describe('RbdFormComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(RbdFormComponent);
     component = fixture.componentInstance;
-    activatedRoute = TestBed.get(ActivatedRoute);
+    activatedRoute = <ActivatedRouteStub>TestBed.inject(ActivatedRoute);
 
     component.loadingReady();
   });
@@ -78,8 +78,8 @@ describe('RbdFormComponent', () => {
       cloneAction = spyOn(component, 'cloneAction').and.returnValue(of(null));
       copyAction = spyOn(component, 'copyAction').and.returnValue(of(null));
       spyOn(component, 'setResponse').and.stub();
-      routerNavigate = spyOn(TestBed.get(Router), 'navigate').and.stub();
-      rbdServiceGetSpy = spyOn(TestBed.get(RbdService), 'get');
+      routerNavigate = spyOn(TestBed.inject(Router), 'navigate').and.stub();
+      rbdServiceGetSpy = spyOn(TestBed.inject(RbdService), 'get');
       rbdServiceGetSpy.and.returnValue(of({ pool_name: 'foo', pool_image: 'bar' }));
       component.mode = undefined;
     });
@@ -202,7 +202,7 @@ describe('RbdFormComponent', () => {
     let rbdService: RbdService;
 
     beforeEach(() => {
-      rbdService = TestBed.get(RbdService);
+      rbdService = TestBed.inject(RbdService);
       component.mode = RbdFormMode.editing;
       fixture.detectChanges();
       spyOn(rbdService, 'get').and.callThrough();
@@ -284,7 +284,7 @@ describe('RbdFormComponent', () => {
 
     describe('test edit form flags', () => {
       const prepare = (pool: string, image: string, enabledFeatures: string[]): void => {
-        const rbdService = TestBed.get(RbdService);
+        const rbdService = TestBed.inject(RbdService);
         spyOn(rbdService, 'get').and.returnValue(
           of({
             name: image,
@@ -341,7 +341,7 @@ describe('RbdFormComponent', () => {
 
     describe('test create form flags', () => {
       beforeEach(() => {
-        const rbdService = TestBed.get(RbdService);
+        const rbdService = TestBed.inject(RbdService);
         spyOn(rbdService, 'defaultFeatures').and.returnValue(of(defaultFeatures));
         component.router = { url: '/block/rbd/create' } as Router;
         fixture.detectChanges();
index f9ad4cf7cb74b797f63258510bd7114717de232d..865a44e7fce8839e5105b36d893668defd11a916 100644 (file)
@@ -67,8 +67,8 @@ describe('RbdListComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(RbdListComponent);
     component = fixture.componentInstance;
-    summaryService = TestBed.get(SummaryService);
-    rbdService = TestBed.get(RbdService);
+    summaryService = TestBed.inject(SummaryService);
+    rbdService = TestBed.inject(RbdService);
 
     // this is needed because summaryService isn't being reset after each test.
     summaryService['summaryDataSource'] = new BehaviorSubject(null);
index c032d0d522b52ccde27e6c58b737472796db1ec3..2fbf1efdbab71d715917192e2bef64cdf4082cbb 100644 (file)
@@ -71,7 +71,7 @@ describe('RbdSnapshotListComponent', () => {
     fixture = TestBed.createComponent(RbdSnapshotListComponent);
     component = fixture.componentInstance;
     component.ngOnChanges();
-    summaryService = TestBed.get(SummaryService);
+    summaryService = TestBed.inject(SummaryService);
   });
 
   it('should create', () => {
@@ -87,8 +87,8 @@ describe('RbdSnapshotListComponent', () => {
 
     beforeEach(() => {
       fixture.detectChanges();
-      const i18n = TestBed.get(I18n);
-      const actionLabelsI18n = TestBed.get(ActionLabelsI18n);
+      const i18n = TestBed.inject(I18n);
+      const actionLabelsI18n = TestBed.inject(ActionLabelsI18n);
       called = false;
       rbdService = new RbdService(null, null);
       notificationService = new NotificationService(null, null, null);
@@ -190,15 +190,15 @@ describe('RbdSnapshotListComponent', () => {
     beforeEach(() => {
       component.poolName = 'pool01';
       component.rbdName = 'image01';
-      spyOn(TestBed.get(BsModalService), 'show').and.callFake(() => {
+      spyOn(TestBed.inject(BsModalService), 'show').and.callFake(() => {
         const ref = new BsModalRef();
         ref.content = new RbdSnapshotFormModalComponent(
           null,
           null,
           null,
           null,
-          TestBed.get(I18n),
-          TestBed.get(ActionLabelsI18n)
+          TestBed.inject(I18n),
+          TestBed.inject(ActionLabelsI18n)
         );
         ref.content.onSubmit = new Subject();
         return ref;
index 557ab5ec76b17d46e18ff6d6e8b95ff4fc78fef9..a953ab064d1667f5e0ae75995fb9bbd18ae6c11e 100644 (file)
@@ -46,8 +46,8 @@ describe('RbdTrashListComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(RbdTrashListComponent);
     component = fixture.componentInstance;
-    summaryService = TestBed.get(SummaryService);
-    rbdService = TestBed.get(RbdService);
+    summaryService = TestBed.inject(SummaryService);
+    rbdService = TestBed.inject(RbdService);
     fixture.detectChanges();
   });
 
index f4f293dfeb2edf06ce93b33202870606d7d1bd98..d9e9e2d7ab8d1280c52bf7f5d4a4a45d22e8a722 100644 (file)
@@ -34,7 +34,7 @@ describe('RbdTrashMoveModalComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(RbdTrashMoveModalComponent);
     component = fixture.componentInstance;
-    httpTesting = TestBed.get(HttpTestingController);
+    httpTesting = TestBed.inject(HttpTestingController);
 
     component.poolName = 'foo';
     component.imageName = 'bar';
@@ -55,7 +55,7 @@ describe('RbdTrashMoveModalComponent', () => {
     let notificationService: NotificationService;
 
     beforeEach(() => {
-      notificationService = TestBed.get(NotificationService);
+      notificationService = TestBed.inject(NotificationService);
       spyOn(notificationService, 'show').and.stub();
       spyOn(component.modalRef, 'hide').and.callThrough();
     });
index db80c7107141b514e2363f71a3cb6fd6561ded63..d8ea8d05e5af656db764a21700f75594bd1c6fdf 100644 (file)
@@ -35,7 +35,7 @@ describe('RbdTrashPurgeModalComponent', () => {
 
   beforeEach(() => {
     fixture = TestBed.createComponent(RbdTrashPurgeModalComponent);
-    httpTesting = TestBed.get(HttpTestingController);
+    httpTesting = TestBed.inject(HttpTestingController);
     component = fixture.componentInstance;
   });
 
@@ -76,8 +76,8 @@ describe('RbdTrashPurgeModalComponent', () => {
 
     beforeEach(() => {
       fixture.detectChanges();
-      notificationService = TestBed.get(NotificationService);
-      modalRef = TestBed.get(BsModalRef);
+      notificationService = TestBed.inject(NotificationService);
+      modalRef = TestBed.inject(BsModalRef);
 
       component.purgeForm.patchValue({ poolName: 'foo' });
 
index 79d800279b4da55259a62c9fb60ce7c1dbd819ca..01808b6cf95feac9fc817ab66cfb4c3afe392612 100644 (file)
@@ -48,9 +48,9 @@ describe('RbdTrashRestoreModalComponent', () => {
     let req: TestRequest;
 
     beforeEach(() => {
-      httpTesting = TestBed.get(HttpTestingController);
-      notificationService = TestBed.get(NotificationService);
-      modalRef = TestBed.get(BsModalRef);
+      httpTesting = TestBed.inject(HttpTestingController);
+      notificationService = TestBed.inject(NotificationService);
+      modalRef = TestBed.inject(BsModalRef);
 
       component.poolName = 'foo';
       component.imageName = 'bar';
index c6db2ce551d87353a508a9792faa3495048ca1f2..25a64a3b01ec359278b0b9d613223eb973fc9ce2 100644 (file)
@@ -383,14 +383,14 @@ describe('CephfsDirectoriesComponent', () => {
       updatedQuotas: {}
     };
 
-    cephfsService = TestBed.get(CephfsService);
+    cephfsService = TestBed.inject(CephfsService);
     lsDirSpy = spyOn(cephfsService, 'lsDir').and.callFake(mockLib.lsDir);
     spyOn(cephfsService, 'mkSnapshot').and.callFake(mockLib.mkSnapshot);
     spyOn(cephfsService, 'rmSnapshot').and.callFake(mockLib.rmSnapshot);
     spyOn(cephfsService, 'updateQuota').and.callFake(mockLib.updateQuota);
 
-    modalShowSpy = spyOn(TestBed.get(BsModalService), 'show').and.callFake(mockLib.modalShow);
-    notificationShowSpy = spyOn(TestBed.get(NotificationService), 'show').and.stub();
+    modalShowSpy = spyOn(TestBed.inject(BsModalService), 'show').and.callFake(mockLib.modalShow);
+    notificationShowSpy = spyOn(TestBed.inject(NotificationService), 'show').and.stub();
 
     fixture = TestBed.createComponent(CephfsDirectoriesComponent);
     component = fixture.componentInstance;
index 288863374673ca6ffcb94fe7d8592097d683418f..5a49f5377d1c33b94cac3b9cd94466ca6471adab 100644 (file)
@@ -110,7 +110,7 @@ describe('CephfsTabsComponent', () => {
         data: [{}, {}, {}, {}]
       }
     };
-    service = TestBed.get(CephfsService);
+    service = TestBed.inject(CephfsService);
     spyOn(service, 'getTabs').and.callFake(() => of(data));
 
     fixture.detectChanges();
index 1844f70ab03f3571a6f1c7781479876cb2d6af82..4d208117fb1c853ba26b6228bd0f6303af465acb 100644 (file)
@@ -49,7 +49,7 @@ describe('HostsComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(HostsComponent);
     component = fixture.componentInstance;
-    hostListSpy = spyOn(TestBed.get(HostService), 'list');
+    hostListSpy = spyOn(TestBed.inject(HostService), 'list');
     fixture.detectChanges();
   });
 
index 8ef14bc6d7686e8a139aa70120b890b12a691432..51de5164befe621977272cdace1d18de8e494ad3 100644 (file)
@@ -34,7 +34,7 @@ describe('InventoryComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(InventoryComponent);
     component = fixture.componentInstance;
-    orchService = TestBed.get(OrchestratorService);
+    orchService = TestBed.inject(OrchestratorService);
     spyOn(orchService, 'status').and.returnValue(of({ available: true }));
     spyOn(orchService, 'inventoryDeviceList').and.callThrough();
   });
index 1072a9e449e81871d4bf115d3e3eaab31c585805..26f3bd78911010a1f1556a5b34a60f0e4764ca80 100644 (file)
@@ -42,8 +42,8 @@ describe('MgrModuleListComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(MgrModuleListComponent);
     component = fixture.componentInstance;
-    mgrModuleService = TestBed.get(MgrModuleService);
-    notificationService = TestBed.get(NotificationService);
+    mgrModuleService = TestBed.inject(MgrModuleService);
+    notificationService = TestBed.inject(NotificationService);
   });
 
   it('should create', () => {
index 029266474d2399c5c23f847c35080169ea949932..d15be4a3598953b345039654e5a3c6f205fc916e 100644 (file)
@@ -59,7 +59,7 @@ describe('MonitorComponent', () => {
       mon_status: null,
       out_quorum: []
     };
-    getMonitorSpy = spyOn(TestBed.get(MonitorService), 'getMonitor').and.returnValue(
+    getMonitorSpy = spyOn(TestBed.inject(MonitorService), 'getMonitor').and.returnValue(
       of(getMonitorPayload)
     );
   });
index 4e61a8dad3d832a644e450811ff8456e0180cb82..7470f48566d6cd1a5119f67e5b7f8a170e4eaf03 100644 (file)
@@ -39,7 +39,7 @@ describe('OsdFlagsModalComponent', () => {
   });
 
   beforeEach(() => {
-    httpTesting = TestBed.get(HttpTestingController);
+    httpTesting = TestBed.inject(HttpTestingController);
     fixture = TestBed.createComponent(OsdFlagsModalComponent);
     component = fixture.componentInstance;
   });
@@ -66,12 +66,12 @@ describe('OsdFlagsModalComponent', () => {
     let bsModalRef: BsModalRef;
 
     beforeEach(() => {
-      notificationService = TestBed.get(NotificationService);
+      notificationService = TestBed.inject(NotificationService);
       spyOn(notificationService, 'show').and.callFake((type) => {
         notificationType = type;
       });
 
-      bsModalRef = TestBed.get(BsModalRef);
+      bsModalRef = TestBed.inject(BsModalRef);
       spyOn(bsModalRef, 'hide').and.callThrough();
       component.unknownFlags = ['foo'];
     });
index 3bc895bc95396bc5061a1d3d770766c7a7f142e4..0acf0f3a1c70790b73417364f793165bda82da6b 100644 (file)
@@ -114,8 +114,8 @@ describe('OsdFormComponent', () => {
     component = fixture.componentInstance;
     form = component.form;
     formHelper = new FormHelper(form);
-    orchService = TestBed.get(OrchestratorService);
-    summaryService = TestBed.get(SummaryService);
+    orchService = TestBed.inject(OrchestratorService);
+    summaryService = TestBed.inject(SummaryService);
     summaryService['summaryDataSource'] = new BehaviorSubject(null);
     summaryService['summaryData$'] = summaryService['summaryDataSource'].asObservable();
     summaryService['summaryDataSource'].next({ version: 'master' });
index 22ac804fa8294b7f08fa7dcb9451aeda124c995d..5dab5675a1dbd1740b38e2de40b2f64b517230f4 100644 (file)
@@ -73,19 +73,21 @@ describe('OsdListComponent', () => {
    * we will have to fake its request to be able to open those modals.
    */
   const mockSafeToDestroy = () => {
-    spyOn(TestBed.get(OsdService), 'safeToDestroy').and.callFake(() =>
+    spyOn(TestBed.inject(OsdService), 'safeToDestroy').and.callFake(() =>
       of({ is_safe_to_destroy: true })
     );
   };
 
   const mockSafeToDelete = () => {
-    spyOn(TestBed.get(OsdService), 'safeToDelete').and.callFake(() =>
+    spyOn(TestBed.inject(OsdService), 'safeToDelete').and.callFake(() =>
       of({ is_safe_to_delete: true })
     );
   };
 
   const mockOrchestratorStatus = () => {
-    spyOn(TestBed.get(OrchestratorService), 'status').and.callFake(() => of({ available: true }));
+    spyOn(TestBed.inject(OrchestratorService), 'status').and.callFake(() =>
+      of({ available: true })
+    );
   };
 
   configureTestBed({
@@ -113,8 +115,8 @@ describe('OsdListComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(OsdListComponent);
     component = fixture.componentInstance;
-    osdService = TestBed.get(OsdService);
-    modalServiceShowSpy = spyOn(TestBed.get(BsModalService), 'show').and.stub();
+    osdService = TestBed.inject(OsdService);
+    modalServiceShowSpy = spyOn(TestBed.inject(BsModalService), 'show').and.stub();
   });
 
   it('should create', () => {
@@ -358,7 +360,7 @@ describe('OsdListComponent', () => {
 
     it('has all menu entries disabled except create', () => {
       const tableActionElement = fixture.debugElement.query(By.directive(TableActionsComponent));
-      const toClassName = TestBed.get(TableActionsComponent).toClassName;
+      const toClassName = TestBed.inject(TableActionsComponent).toClassName;
       const getActionClasses = (action: CdTableAction) =>
         tableActionElement.query(By.css(`.${toClassName(action.name)} .dropdown-item`)).classes;
 
index 3fb4ee792e27e00b0b1fc979fce4a951e3976b85..f5c7ddd237159f28ff6fbe12f18095a9bc99cdf2 100644 (file)
@@ -37,7 +37,7 @@ describe('OsdPgScrubModalComponent', () => {
     fixture = TestBed.createComponent(OsdPgScrubModalComponent);
     component = fixture.componentInstance;
     fixture.detectChanges();
-    configurationService = TestBed.get(ConfigurationService);
+    configurationService = TestBed.inject(ConfigurationService);
   });
 
   it('should create', () => {
@@ -48,8 +48,8 @@ describe('OsdPgScrubModalComponent', () => {
     let notificationService: NotificationService;
 
     beforeEach(() => {
-      spyOn(TestBed.get(Router), 'navigate').and.stub();
-      notificationService = TestBed.get(NotificationService);
+      spyOn(TestBed.inject(Router), 'navigate').and.stub();
+      notificationService = TestBed.inject(NotificationService);
       spyOn(notificationService, 'show');
     });
 
index bae23227ada34c001040b11fc068872b3bdf9e7c..d050b5932ca1ce1667df0c675aef3f7678e49047 100755 (executable)
@@ -37,7 +37,7 @@ describe('OsdRecvSpeedModalComponent', () => {
     fixture = TestBed.createComponent(OsdRecvSpeedModalComponent);
     component = fixture.componentInstance;
     fixture.detectChanges();
-    configurationService = TestBed.get(ConfigurationService);
+    configurationService = TestBed.inject(ConfigurationService);
     configOptions = [
       {
         name: 'osd_max_backfills',
index 78c3860c5e39bd2b3d53fe1823abb778c64e7292..e59f360340adc211119b338d1beba242a468042d 100644 (file)
@@ -43,7 +43,9 @@ describe('OsdReweightModalComponent', () => {
     component.osdId = 1;
     component.reweightForm.get('weight').setValue(0.5);
 
-    const osdServiceSpy = spyOn(TestBed.get(OsdService), 'reweight').and.callFake(() => of(true));
+    const osdServiceSpy = spyOn(TestBed.inject(OsdService), 'reweight').and.callFake(() =>
+      of(true)
+    );
     component.reweight();
 
     expect(osdServiceSpy.calls.count()).toBe(1);
index b160a67caa20116c02a5c43693a6076636705e8b..c0446c0bac75b49fc63f39533d4cf049c4ef7106 100644 (file)
@@ -102,7 +102,7 @@ describe('SilenceFormComponent', () => {
     spyOn(global, 'Date').and.callFake((arg) => (arg ? new originalDate(arg) : beginningDate));
 
     prometheus = new PrometheusHelper();
-    prometheusService = TestBed.get(PrometheusService);
+    prometheusService = TestBed.inject(PrometheusService);
     spyOn(prometheusService, 'getAlerts').and.callFake(() =>
       of([prometheus.createAlert('alert0')])
     );
@@ -126,12 +126,12 @@ describe('SilenceFormComponent', () => {
       })
     );
 
-    router = TestBed.get(Router);
+    router = TestBed.inject(Router);
 
-    notificationService = TestBed.get(NotificationService);
+    notificationService = TestBed.inject(NotificationService);
     spyOn(notificationService, 'show').and.stub();
 
-    authStorageService = TestBed.get(AuthStorageService);
+    authStorageService = TestBed.inject(AuthStorageService);
     spyOn(authStorageService, 'getUsername').and.returnValue('someUser');
 
     fixture = TestBed.createComponent(SilenceFormComponent);
@@ -460,7 +460,7 @@ describe('SilenceFormComponent', () => {
       addMatcher('alertname', 'alert.*', true);
       expectMatch(null);
 
-      const modalService = TestBed.get(BsModalService);
+      const modalService = TestBed.inject(BsModalService);
       spyOn(modalService, 'show').and.callFake(() => {
         return {
           content: {
index 6a60f83f6e442113d9e2bb15bd5d872dc8bbd868..c8d47fd78f032560f1907d116ef1c78b42624491 100644 (file)
@@ -45,7 +45,7 @@ describe('SilenceListComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(SilenceListComponent);
     component = fixture.componentInstance;
-    prometheusService = TestBed.get(PrometheusService);
+    prometheusService = TestBed.inject(PrometheusService);
   });
 
   it('should create', () => {
@@ -117,7 +117,7 @@ describe('SilenceListComponent', () => {
       const mockObservable = () => of([]);
       spyOn(component, 'refresh').and.callFake(mockObservable);
       spyOn(prometheusService, 'expireSilence').and.callFake(mockObservable);
-      spyOn(TestBed.get(BsModalService), 'show').and.callFake((deletionClass, config) => {
+      spyOn(TestBed.inject(BsModalService), 'show').and.callFake((deletionClass, config) => {
         return {
           content: Object.assign(new deletionClass(), config.initialState)
         };
@@ -125,7 +125,7 @@ describe('SilenceListComponent', () => {
     });
 
     it('should expire a silence', () => {
-      const notificationService = TestBed.get(NotificationService);
+      const notificationService = TestBed.inject(NotificationService);
       spyOn(notificationService, 'show').and.stub();
       expectSilenceToExpire('someSilenceId');
       expect(notificationService.show).toHaveBeenCalledWith(
index 207a4fb5a3444ab6dd91b35dd3bff98439698bd6..b357903a364085b0cb8a6920005c0db54784f57d 100644 (file)
@@ -85,8 +85,8 @@ describe('ServiceDaemonListComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(ServiceDaemonListComponent);
     component = fixture.componentInstance;
-    const hostService = TestBed.get(HostService);
-    const cephServiceService = TestBed.get(CephServiceService);
+    const hostService = TestBed.inject(HostService);
+    const cephServiceService = TestBed.inject(CephServiceService);
     spyOn(hostService, 'getDaemons').and.callFake(() =>
       of(getDaemonsByHostname(component.hostname))
     );
index 347cfa1b00e18e103087798c5700cafc68382169..d2e7470d1884bdaf0ec5dcd70b82c94ee602d98b 100644 (file)
@@ -67,8 +67,8 @@ describe('ServicesComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(ServicesComponent);
     component = fixture.componentInstance;
-    const orchService = TestBed.get(OrchestratorService);
-    const cephServiceService = TestBed.get(CephServiceService);
+    const orchService = TestBed.inject(OrchestratorService);
+    const cephServiceService = TestBed.inject(CephServiceService);
     spyOn(orchService, 'status').and.returnValue(of({ available: true }));
     spyOn(cephServiceService, 'list').and.returnValue(of(services));
     fixture.detectChanges();
index cc56046df62e8722418ca1ea32c0b84b4a1fe1b4..2e5e95ece7527b308f57128c7c4283d206f585ce 100644 (file)
@@ -63,7 +63,7 @@ describe('TelemetryComponent', () => {
     beforeEach(() => {
       fixture = TestBed.createComponent(TelemetryComponent);
       component = fixture.componentInstance;
-      mgrModuleService = TestBed.get(MgrModuleService);
+      mgrModuleService = TestBed.inject(MgrModuleService);
       options = {};
       configs = {};
       optionsNames.forEach((name) => (options[name] = { name }));
@@ -71,8 +71,8 @@ describe('TelemetryComponent', () => {
       spyOn(mgrModuleService, 'getOptions').and.callFake(() => observableOf(options));
       spyOn(mgrModuleService, 'getConfig').and.callFake(() => observableOf(configs));
       fixture.detectChanges();
-      httpTesting = TestBed.get(HttpTestingController);
-      router = TestBed.get(Router);
+      httpTesting = TestBed.inject(HttpTestingController);
+      router = TestBed.inject(Router);
       spyOn(router, 'navigate');
     });
 
@@ -142,9 +142,9 @@ describe('TelemetryComponent', () => {
       fixture = TestBed.createComponent(TelemetryComponent);
       component = fixture.componentInstance;
       fixture.detectChanges();
-      telemetryService = TestBed.get(TelemetryService);
-      httpTesting = TestBed.get(HttpTestingController);
-      router = TestBed.get(Router);
+      telemetryService = TestBed.inject(TelemetryService);
+      httpTesting = TestBed.inject(HttpTestingController);
+      router = TestBed.inject(Router);
       spyOn(router, 'navigate');
     });
 
@@ -156,7 +156,7 @@ describe('TelemetryComponent', () => {
       spyOn(telemetryService, 'getReport').and.returnValue(observableOf(reportText));
       component.ngOnInit();
 
-      const downloadSpy = spyOn(TestBed.get(TextToDownloadService), 'download');
+      const downloadSpy = spyOn(TestBed.inject(TextToDownloadService), 'download');
       const filename = 'reportText.json';
       component.download(reportText, filename);
       expect(downloadSpy).toHaveBeenCalledWith(JSON.stringify(reportText, null, 2), filename);
index 50a96ee6b51b58da2779cdbbf0a7020cc9eda28f..8d2f928220c7a3bf145896fe6238b4857d5c7908 100644 (file)
@@ -68,7 +68,7 @@ describe('HealthComponent', () => {
   });
 
   beforeEach(() => {
-    fakeFeatureTogglesService = spyOn(TestBed.get(FeatureTogglesService), 'get').and.returnValue(
+    fakeFeatureTogglesService = spyOn(TestBed.inject(FeatureTogglesService), 'get').and.returnValue(
       of({
         rbd: true,
         mirroring: true,
@@ -79,7 +79,7 @@ describe('HealthComponent', () => {
     );
     fixture = TestBed.createComponent(HealthComponent);
     component = fixture.componentInstance;
-    getHealthSpy = spyOn(TestBed.get(HealthService), 'getMinimalHealth');
+    getHealthSpy = spyOn(TestBed.inject(HealthService), 'getMinimalHealth');
     getHealthSpy.and.returnValue(of(healthPayload));
   });
 
index cc5f9190a919658213de3a3728a960dce244faeb..32e05b04114468f9f9611da29f79ab38b3d6772e 100644 (file)
@@ -11,7 +11,7 @@ describe('MdsSummaryPipe', () => {
   });
 
   beforeEach(() => {
-    pipe = TestBed.get(MdsSummaryPipe);
+    pipe = TestBed.inject(MdsSummaryPipe);
   });
 
   it('create an instance', () => {
index 51e70d4d8ed6e6a498f66eed08756f61df38d267..d9d0cba7330c63ef54083dd2b43d6e021775ceb6 100644 (file)
@@ -12,7 +12,7 @@ describe('MgrSummaryPipe', () => {
   });
 
   beforeEach(() => {
-    pipe = TestBed.get(MgrSummaryPipe);
+    pipe = TestBed.inject(MgrSummaryPipe);
   });
 
   it('create an instance', () => {
index 9d193a5e0f6ee784c77a1565845a57b7e1da501e..5d64cd6c91e8e6217a6f29ea1ec2f8c2ec854f91 100644 (file)
@@ -11,7 +11,7 @@ describe('MonSummaryPipe', () => {
   });
 
   beforeEach(() => {
-    pipe = TestBed.get(MonSummaryPipe);
+    pipe = TestBed.inject(MonSummaryPipe);
   });
 
   it('create an instance', () => {
index 5b7010907d3408d301464ade07839b2e9fdc2edb..0de9c21f9cfa0c606e5fef4128b0a4d2bc4ef9a5 100644 (file)
@@ -10,7 +10,7 @@ describe('OsdSummaryPipe', () => {
   });
 
   beforeEach(() => {
-    pipe = TestBed.get(OsdSummaryPipe);
+    pipe = TestBed.inject(OsdSummaryPipe);
   });
 
   it('create an instance', () => {
index 1a5b2939003fc1e007187ae9d9a6becca8520d39..4fd4e2f1f08b1f87be4061ce567a662690fea07b 100644 (file)
@@ -20,7 +20,7 @@ describe('NfsFormClientComponent', () => {
 
   beforeEach(() => {
     fixture = TestBed.createComponent(NfsFormClientComponent);
-    const formBuilder = TestBed.get(CdFormBuilder);
+    const formBuilder = TestBed.inject(CdFormBuilder);
     component = fixture.componentInstance;
 
     component.form = new CdFormGroup({
index b00c049c0781989c0cc2e6ea71709558e89e0e67..ad4df81dd5edaee71abdf8dce418c23ebb9ff308 100644 (file)
@@ -44,7 +44,7 @@ describe('NfsFormComponent', () => {
   });
 
   beforeEach(() => {
-    const summaryService = TestBed.get(SummaryService);
+    const summaryService = TestBed.inject(SummaryService);
     spyOn(summaryService, 'refresh').and.callFake(() => true);
     spyOn(summaryService, 'subscribeOnce').and.callFake(() =>
       of({
@@ -54,8 +54,8 @@ describe('NfsFormComponent', () => {
 
     fixture = TestBed.createComponent(NfsFormComponent);
     component = fixture.componentInstance;
-    httpTesting = TestBed.get(HttpTestingController);
-    activatedRoute = TestBed.get(ActivatedRoute);
+    httpTesting = TestBed.inject(HttpTestingController);
+    activatedRoute = <ActivatedRouteStub>TestBed.inject(ActivatedRoute);
     fixture.detectChanges();
 
     httpTesting.expectOne('api/nfs-ganesha/daemon').flush([
index b4811722a85ee3f8c4fbbadc4b14bc8457fd547d..79bb80811d498502fa928f3bacd6c5d2e38ab1af 100644 (file)
@@ -50,9 +50,9 @@ describe('NfsListComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(NfsListComponent);
     component = fixture.componentInstance;
-    summaryService = TestBed.get(SummaryService);
-    nfsService = TestBed.get(NfsService);
-    httpTesting = TestBed.get(HttpTestingController);
+    summaryService = TestBed.inject(SummaryService);
+    nfsService = TestBed.inject(NfsService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   it('should create', () => {
index 769dde5832441e82eaeae215bb5050d6d79c73eb..f6c2d7a71b4e6c984031bdf9cc17ed2cb6c75559 100644 (file)
@@ -19,7 +19,7 @@ describe('TablePerformanceCounterComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(TablePerformanceCounterComponent);
     component = fixture.componentInstance;
-    httpTesting = TestBed.get(HttpTestingController);
+    httpTesting = TestBed.inject(HttpTestingController);
     fixture.detectChanges();
   });
 
index 003ec29bef7b200905e59f558ad471312e2784ac..de2d9fdad4f446458e74eae3a2e17c004f085f02 100644 (file)
@@ -111,7 +111,7 @@ describe('CrushRuleFormComponent', () => {
     fixtureHelper = new FixtureHelper(fixture);
     component = fixture.componentInstance;
     formHelper = new FormHelper(component.form);
-    crushRuleService = TestBed.get(CrushRuleService);
+    crushRuleService = TestBed.inject(CrushRuleService);
     data = {
       names: ['rule1', 'rule2'],
       /**
@@ -248,7 +248,7 @@ describe('CrushRuleFormComponent', () => {
 
   describe('submission', () => {
     beforeEach(() => {
-      const taskWrapper = TestBed.get(TaskWrapperService);
+      const taskWrapper = TestBed.inject(TaskWrapperService);
       spyOn(taskWrapper, 'wrapTaskAroundCall').and.callThrough();
       spyOn(crushRuleService, 'create').and.stub();
     });
index 2628f1f69a42899de41031afac3256fbd7d7a52d..43129b6f34f8933497e4bb7af197f2c406fe12a3 100644 (file)
@@ -59,7 +59,7 @@ describe('ErasureCodeProfileFormModalComponent', () => {
     fixtureHelper = new FixtureHelper(fixture);
     component = fixture.componentInstance;
     formHelper = new FormHelper(component.form);
-    ecpService = TestBed.get(ErasureCodeProfileService);
+    ecpService = TestBed.inject(ErasureCodeProfileService);
     data = {
       plugins: ['isa', 'jerasure', 'shec', 'lrc'],
       names: ['ecp1', 'ecp2'],
@@ -400,7 +400,7 @@ describe('ErasureCodeProfileFormModalComponent', () => {
       submittedEcp['packetsize'] = 2048;
       submittedEcp['technique'] = 'reed_sol_van';
 
-      const taskWrapper = TestBed.get(TaskWrapperService);
+      const taskWrapper = TestBed.inject(TaskWrapperService);
       spyOn(taskWrapper, 'wrapTaskAroundCall').and.callThrough();
       spyOn(ecpService, 'create').and.stub();
     });
index d172c7c45635208e87372ae1923741e77d2598b6..945a34fcaea404cdff8a58a7af3b42bec4eea437 100644 (file)
@@ -109,7 +109,7 @@ describe('PoolFormComponent', () => {
     poolServiceMethod: 'create' | 'update' = 'create'
   ) => {
     spyOn(poolService, poolServiceMethod).and.stub();
-    const taskWrapper = TestBed.get(TaskWrapperService);
+    const taskWrapper = TestBed.inject(TaskWrapperService);
     spyOn(taskWrapper, 'wrapTaskAroundCall').and.callThrough();
     component.submit();
     expect(poolService[poolServiceMethod]).toHaveBeenCalledWith(pool);
@@ -190,14 +190,14 @@ describe('PoolFormComponent', () => {
   let navigationSpy: jasmine.Spy;
 
   beforeEach(() => {
-    poolService = TestBed.get(PoolService);
+    poolService = TestBed.inject(PoolService);
     setInfo();
     spyOn(poolService, 'getInfo').and.callFake(() => of(infoReturn));
 
-    ecpService = TestBed.get(ErasureCodeProfileService);
-    crushRuleService = TestBed.get(CrushRuleService);
+    ecpService = TestBed.inject(ErasureCodeProfileService);
+    crushRuleService = TestBed.inject(CrushRuleService);
 
-    router = TestBed.get(Router);
+    router = TestBed.inject(Router);
     navigationSpy = spyOn(router, 'navigate').and.stub();
 
     setUpPoolComponent();
@@ -226,7 +226,7 @@ describe('PoolFormComponent', () => {
         read: false,
         delete: false
       };
-      authStorageService = TestBed.get(AuthStorageService);
+      authStorageService = TestBed.inject(AuthStorageService);
       spyOn(authStorageService, 'getPermissions').and.callFake(() => ({
         pool: poolPermissions
       }));
@@ -811,7 +811,7 @@ describe('PoolFormComponent', () => {
     it('should select the newly created rule', () => {
       expect(form.getValue('crushRule').rule_name).toBe('rep1');
       const name = 'awesomeRule';
-      spyOn(TestBed.get(BsModalService), 'show').and.callFake(() => {
+      spyOn(TestBed.inject(BsModalService), 'show').and.callFake(() => {
         return {
           content: {
             submitAction: of({ name })
@@ -874,7 +874,7 @@ describe('PoolFormComponent', () => {
       };
 
       beforeEach(() => {
-        modalSpy = spyOn(TestBed.get(BsModalService), 'show').and.callFake(
+        modalSpy = spyOn(TestBed.inject(BsModalService), 'show').and.callFake(
           (deletionClass: any, config: any) => {
             deletion = Object.assign(new deletionClass(), config.initialState);
             return {
@@ -888,7 +888,7 @@ describe('PoolFormComponent', () => {
           rules.splice(index, 1);
           return of(undefined);
         });
-        taskWrapper = TestBed.get(TaskWrapperService);
+        taskWrapper = TestBed.inject(TaskWrapperService);
         spyOn(taskWrapper, 'wrapTaskAroundCall').and.callThrough();
       });
 
@@ -986,7 +986,7 @@ describe('PoolFormComponent', () => {
       spyOn(ecpService, 'list').and.callFake(() => of(infoReturn.erasure_code_profiles));
       expect(form.getValue('erasureProfile').name).toBe('ecp1');
       const name = 'awesomeProfile';
-      spyOn(TestBed.get(BsModalService), 'show').and.callFake(() => {
+      spyOn(TestBed.inject(BsModalService), 'show').and.callFake(() => {
         return {
           content: {
             submitAction: of({ name })
@@ -1030,7 +1030,7 @@ describe('PoolFormComponent', () => {
 
       beforeEach(() => {
         deletion = undefined;
-        modalSpy = spyOn(TestBed.get(BsModalService), 'show').and.callFake(
+        modalSpy = spyOn(TestBed.inject(BsModalService), 'show').and.callFake(
           (comp: any, init: any) => {
             modal = modalServiceShow(comp, init);
             return modal.ref;
@@ -1042,7 +1042,7 @@ describe('PoolFormComponent', () => {
           profiles.splice(index, 1);
           return of({ status: 202 });
         });
-        taskWrapper = TestBed.get(TaskWrapperService);
+        taskWrapper = TestBed.inject(TaskWrapperService);
         spyOn(taskWrapper, 'wrapTaskAroundCall').and.callThrough();
 
         const ecp2 = new ErasureCodeProfile();
index dbe4ec6f209194af3a9501bf774574559017875c..19f76948a7038a4c2c29281a6995cd845ce1aea8 100644 (file)
@@ -64,7 +64,7 @@ describe('PoolListComponent', () => {
     fixture = TestBed.createComponent(PoolListComponent);
     component = fixture.componentInstance;
     component.permissions.pool.read = true;
-    poolService = TestBed.get(PoolService);
+    poolService = TestBed.inject(PoolService);
     spyOn(poolService, 'getList').and.callFake(() => of(getPoolList()));
     fixture.detectChanges();
   });
@@ -87,10 +87,10 @@ describe('PoolListComponent', () => {
 
     beforeEach(() => {
       configOptRead = true;
-      spyOn(TestBed.get(AuthStorageService), 'getPermissions').and.callFake(() => ({
+      spyOn(TestBed.inject(AuthStorageService), 'getPermissions').and.callFake(() => ({
         configOpt: { read: configOptRead }
       }));
-      configurationService = TestBed.get(ConfigurationService);
+      configurationService = TestBed.inject(ConfigurationService);
     });
 
     it('should set value correctly if mon_allow_pool_delete flag is set to true', () => {
@@ -171,13 +171,13 @@ describe('PoolListComponent', () => {
     };
 
     beforeEach(() => {
-      spyOn(TestBed.get(BsModalService), 'show').and.callFake((deletionClass, config) => {
+      spyOn(TestBed.inject(BsModalService), 'show').and.callFake((deletionClass, config) => {
         return {
           content: Object.assign(new deletionClass(), config.initialState)
         };
       });
       spyOn(poolService, 'delete').and.stub();
-      taskWrapper = TestBed.get(TaskWrapperService);
+      taskWrapper = TestBed.inject(TaskWrapperService);
       spyOn(taskWrapper, 'wrapTaskAroundCall').and.callThrough();
     });
 
@@ -198,7 +198,7 @@ describe('PoolListComponent', () => {
     };
 
     beforeEach(() => {
-      summaryService = TestBed.get(SummaryService);
+      summaryService = TestBed.inject(SummaryService);
       summaryService['summaryDataSource'].next({
         executing_tasks: [],
         finished_tasks: []
index ac69006731f6e0d38016549dead966314f5cdaf9..c7cb01402842bd5f8c4cf9e058ade9708e2a046e 100644 (file)
@@ -43,10 +43,10 @@ describe('RgwBucketFormComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(RgwBucketFormComponent);
     component = fixture.componentInstance;
-    rgwBucketService = TestBed.get(RgwBucketService);
+    rgwBucketService = TestBed.inject(RgwBucketService);
     rgwBucketServiceGetSpy = spyOn(rgwBucketService, 'get');
-    getPlacementTargetsSpy = spyOn(TestBed.get(RgwSiteService), 'get');
-    enumerateSpy = spyOn(TestBed.get(RgwUserService), 'enumerate');
+    getPlacementTargetsSpy = spyOn(TestBed.inject(RgwSiteService), 'get');
+    enumerateSpy = spyOn(TestBed.inject(RgwUserService), 'enumerate');
     formHelper = new FormHelper(component.bucketForm);
   });
 
@@ -178,8 +178,8 @@ describe('RgwBucketFormComponent', () => {
     let notificationService: NotificationService;
 
     beforeEach(() => {
-      spyOn(TestBed.get(Router), 'navigate').and.stub();
-      notificationService = TestBed.get(NotificationService);
+      spyOn(TestBed.inject(Router), 'navigate').and.stub();
+      notificationService = TestBed.inject(NotificationService);
       spyOn(notificationService, 'show');
     });
 
index 19aacc0acd95da6e65ea6df7511777de139abf79..acb6e32465660b4aa5a266859c28caa23db996d3 100644 (file)
@@ -42,9 +42,9 @@ describe('RgwDaemonListComponent', () => {
   });
 
   beforeEach(() => {
-    getPermissionsSpy = spyOn(TestBed.get(AuthStorageService), 'getPermissions');
+    getPermissionsSpy = spyOn(TestBed.inject(AuthStorageService), 'getPermissions');
     getPermissionsSpy.and.returnValue(new Permissions({}));
-    getRealmsSpy = spyOn(TestBed.get(RgwSiteService), 'get');
+    getRealmsSpy = spyOn(TestBed.inject(RgwSiteService), 'get');
     getRealmsSpy.and.returnValue(of([]));
     fixture = TestBed.createComponent(RgwDaemonListComponent);
     component = fixture.componentInstance;
index 85632651ff4d59d8230791328addde42cc0ccb97..516bddd03065151f623d9eb120ded17969ea4b13 100644 (file)
@@ -42,7 +42,7 @@ describe('RgwUserFormComponent', () => {
     fixture = TestBed.createComponent(RgwUserFormComponent);
     component = fixture.componentInstance;
     fixture.detectChanges();
-    rgwUserService = TestBed.get(RgwUserService);
+    rgwUserService = TestBed.inject(RgwUserService);
     formHelper = new FormHelper(component.userForm);
   });
 
@@ -271,8 +271,8 @@ describe('RgwUserFormComponent', () => {
     let notificationService: NotificationService;
 
     beforeEach(() => {
-      spyOn(TestBed.get(Router), 'navigate').and.stub();
-      notificationService = TestBed.get(NotificationService);
+      spyOn(TestBed.inject(Router), 'navigate').and.stub();
+      notificationService = TestBed.inject(NotificationService);
       spyOn(notificationService, 'show');
     });
 
index fa185d045dda303e1b5da09391ff4c91e8e9f9d2..4bd5ef179e818d8fe9a8c2b6bb83d9cc7e858d0f 100644 (file)
@@ -12,7 +12,7 @@ describe('PgCategoryService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(PgCategoryService);
+    service = TestBed.inject(PgCategoryService);
   });
 
   it('should be created', () => {
index 395608b34321b1f2adb74781ecbfe2630ff55a37..70dd76f6106f5606e0630f1cc15655f7a288ec8b 100644 (file)
@@ -90,7 +90,7 @@ describe('OsdSmartListComponent', () => {
     component = fixture.componentInstance;
     fixture.detectChanges();
 
-    osdService = TestBed.get(OsdService);
+    osdService = TestBed.inject(OsdService);
   });
 
   it('should create', () => {
index c336d26657e6fe579924f089d18b57f86be73411..eae34d33f9d85ae745308362623f2dea209fdb73 100755 (executable)
@@ -40,10 +40,10 @@ describe('LoginPasswordFormComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(LoginPasswordFormComponent);
     component = fixture.componentInstance;
-    httpTesting = TestBed.get(HttpTestingController);
-    router = TestBed.get(Router);
-    authStorageService = TestBed.get(AuthStorageService);
-    authService = TestBed.get(AuthService);
+    httpTesting = TestBed.inject(HttpTestingController);
+    router = TestBed.inject(Router);
+    authStorageService = TestBed.inject(AuthStorageService);
+    authService = TestBed.inject(AuthService);
     spyOn(router, 'navigate');
     fixture.detectChanges();
     form = component.userForm;
index 3cff98667da42827c3750fa7f0dbda9867cfe7c0..2210cef8d226ef108c6decf578d14be425d21d78 100644 (file)
@@ -47,12 +47,12 @@ describe('RoleFormComponent', () => {
     fixture = TestBed.createComponent(RoleFormComponent);
     component = fixture.componentInstance;
     form = component.roleForm;
-    httpTesting = TestBed.get(HttpTestingController);
-    roleService = TestBed.get(RoleService);
-    router = TestBed.get(Router);
+    httpTesting = TestBed.inject(HttpTestingController);
+    roleService = TestBed.inject(RoleService);
+    router = TestBed.inject(Router);
     spyOn(router, 'navigate');
     fixture.detectChanges();
-    const notify = TestBed.get(NotificationService);
+    const notify = TestBed.inject(NotificationService);
     spyOn(notify, 'show');
   });
 
@@ -172,7 +172,7 @@ describe('RoleFormComponent', () => {
     const scopes = ['osd', 'user'];
     beforeEach(() => {
       spyOn(roleService, 'get').and.callFake(() => of(role));
-      spyOn(TestBed.get(ScopeService), 'list').and.callFake(() => of(scopes));
+      spyOn(TestBed.inject(ScopeService), 'list').and.callFake(() => of(scopes));
       setUrl('/user-management/roles/edit/role1');
       component.ngOnInit();
       const reqScopes = httpTesting.expectOne('ui-api/scope');
index bd06b8e7dd2c12f85a0c1ae5e75a0fee2983e399..abfd8f305091f6ac269017448b147da159490d5e 100644 (file)
@@ -60,17 +60,17 @@ describe('UserFormComponent', () => {
   });
 
   beforeEach(() => {
-    spyOn(TestBed.get(PasswordPolicyService), 'getHelpText').and.callFake(() => of(''));
+    spyOn(TestBed.inject(PasswordPolicyService), 'getHelpText').and.callFake(() => of(''));
     fixture = TestBed.createComponent(UserFormComponent);
     component = fixture.componentInstance;
     form = component.userForm;
-    httpTesting = TestBed.get(HttpTestingController);
-    userService = TestBed.get(UserService);
-    modalService = TestBed.get(BsModalService);
-    router = TestBed.get(Router);
+    httpTesting = TestBed.inject(HttpTestingController);
+    userService = TestBed.inject(UserService);
+    modalService = TestBed.inject(BsModalService);
+    router = TestBed.inject(Router);
     spyOn(router, 'navigate');
     fixture.detectChanges();
-    const notify = TestBed.get(NotificationService);
+    const notify = TestBed.inject(NotificationService);
     spyOn(notify, 'show');
     formHelper = new FormHelper(form);
   });
@@ -176,9 +176,9 @@ describe('UserFormComponent', () => {
 
     beforeEach(() => {
       spyOn(userService, 'get').and.callFake(() => of(user));
-      spyOn(TestBed.get(RoleService), 'list').and.callFake(() => of(roles));
+      spyOn(TestBed.inject(RoleService), 'list').and.callFake(() => of(roles));
       setUrl('/user-management/users/edit/user1');
-      spyOn(TestBed.get(SettingsService), 'getStandardSettings').and.callFake(() =>
+      spyOn(TestBed.inject(SettingsService), 'getStandardSettings').and.callFake(() =>
         of({
           user_pwd_expiration_warning_1: 10,
           user_pwd_expiration_warning_2: 5,
@@ -215,7 +215,7 @@ describe('UserFormComponent', () => {
     });
 
     it('should alert if user is removing needed role permission', () => {
-      spyOn(TestBed.get(AuthStorageService), 'getUsername').and.callFake(() => user.username);
+      spyOn(TestBed.inject(AuthStorageService), 'getUsername').and.callFake(() => user.username);
       let modalBodyTpl = null;
       spyOn(modalService, 'show').and.callFake((_content, config) => {
         modalBodyTpl = config.initialState.bodyTpl;
@@ -226,7 +226,7 @@ describe('UserFormComponent', () => {
     });
 
     it('should logout if current user roles have been changed', () => {
-      spyOn(TestBed.get(AuthStorageService), 'getUsername').and.callFake(() => user.username);
+      spyOn(TestBed.inject(AuthStorageService), 'getUsername').and.callFake(() => user.username);
       formHelper.setValue('roles', ['user-manager']);
       component.submit();
       const userReq = httpTesting.expectOne(`api/user/${user.username}`);
@@ -237,7 +237,7 @@ describe('UserFormComponent', () => {
     });
 
     it('should submit', () => {
-      spyOn(TestBed.get(AuthStorageService), 'getUsername').and.callFake(() => user.username);
+      spyOn(TestBed.inject(AuthStorageService), 'getUsername').and.callFake(() => user.username);
       component.submit();
       const userReq = httpTesting.expectOne(`api/user/${user.username}`);
       expect(userReq.request.method).toBe('PUT');
index 44e9201381b5d32059e387c562bb8e8b2a79d197..faaa3057c927eb3960a614aff4be30f8e7528a85 100644 (file)
@@ -39,9 +39,9 @@ describe('UserPasswordFormComponent', () => {
     fixture = TestBed.createComponent(UserPasswordFormComponent);
     component = fixture.componentInstance;
     form = component.userForm;
-    httpTesting = TestBed.get(HttpTestingController);
-    router = TestBed.get(Router);
-    authStorageService = TestBed.get(AuthStorageService);
+    httpTesting = TestBed.inject(HttpTestingController);
+    router = TestBed.inject(Router);
+    authStorageService = TestBed.inject(AuthStorageService);
     spyOn(router, 'navigate');
     fixture.detectChanges();
     formHelper = new FormHelper(form);
index f593d268ec85d2ef0eaee80894b31d38bb75d16c..5bb656157d9387216bbe0e152be6786906171242 100644 (file)
@@ -53,7 +53,7 @@ describe('BreadcrumbsComponent', () => {
 
   beforeEach(() => {
     fixture = TestBed.createComponent(BreadcrumbsComponent);
-    router = TestBed.get(Router);
+    router = TestBed.inject(Router);
     component = fixture.componentInstance;
     fixture.detectChanges();
     expect(component.crumbs).toEqual([]);
index dacdb24c0428d161147a73817a3a8b2506ee0162..3111d482b02e14dc7601acad85abca25af868ae3 100644 (file)
@@ -24,7 +24,7 @@ describe('NotificationsComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(NotificationsComponent);
     component = fixture.componentInstance;
-    summaryService = TestBed.get(SummaryService);
+    summaryService = TestBed.inject(SummaryService);
 
     fixture.detectChanges();
   });
index 986907d53dcbd0bcd1ee2cb2aad5eb2ec44a228c..484a280b7bef7c2490a7255349bdeb06ca885996 100644 (file)
@@ -19,8 +19,8 @@ describe('AuthService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(AuthService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(AuthService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
@@ -45,7 +45,7 @@ describe('AuthService', () => {
   }));
 
   it('should logout and remove the user', () => {
-    const router = TestBed.get(Router);
+    const router = TestBed.inject(Router);
     spyOn(router, 'navigate').and.stub();
 
     service.logout();
index a71e67a519c20aca12af376a79a56b3558157488..1a2ea9fef7d44aecd1bdbf940072767363be25a1 100644 (file)
@@ -14,8 +14,8 @@ describe('CephfsService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(CephfsService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(CephfsService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 2c9da18c7e7bae21edd33589ad9a14dce89890fc..cbd9e1d0300c020e0cb8485f78ceb05c2fc46346 100644 (file)
@@ -15,8 +15,8 @@ describe('ConfigurationService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(ConfigurationService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(ConfigurationService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 4a200941bc7655384cf74b1e95714eb3e066013e..493fc920238dfc07cd0f52444050461630bd28bd 100644 (file)
@@ -15,8 +15,8 @@ describe('CrushRuleService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(CrushRuleService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(CrushRuleService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index c2a90c27fb8106e500d7a654888725a2d5b83116..591ca879b6d1e6493d1a82c4f3245e4377a91aa5 100644 (file)
@@ -17,8 +17,8 @@ describe('ErasureCodeProfileService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(ErasureCodeProfileService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(ErasureCodeProfileService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 8273640188e477b4f1cb9cc2578027a85ef09257..eaf5d029bd1fdb65761a7dbefbfecce474381448 100644 (file)
@@ -14,8 +14,8 @@ describe('HealthService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(HealthService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(HealthService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 0f58cd098aff62433a5d97aceb69af524c7901e0..1b80b3f77880bef143bd883e3462cbb0d794fbc4 100644 (file)
@@ -14,8 +14,8 @@ describe('HostService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(HostService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(HostService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 7eb21db917344583ad05d4eada34cb181b590efb..9ee4eb5b8ecc2cbed4ec8a08f417ee07242f71cc 100644 (file)
@@ -14,8 +14,8 @@ describe('IscsiService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(IscsiService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(IscsiService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index cc855f2aaee0892fdb25e0b4f34baff593418d37..90eb5adba57c3e455a6e319037c3555a719b46d4 100644 (file)
@@ -14,8 +14,8 @@ describe('LoggingService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(LoggingService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(LoggingService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 8e7777a63f47ef2536860b575f4384f50eaa3926..626eeea900328b836b9881249a31f18497463cd6 100644 (file)
@@ -14,8 +14,8 @@ describe('LogsService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(LogsService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(LogsService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index d996c5659374e82f9468efcba7c6a58b8c06a173..7d262b3960111b63393e27f97a990964da6f56d4 100644 (file)
@@ -14,8 +14,8 @@ describe('MgrModuleService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(MgrModuleService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(MgrModuleService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 0eca853ac663208365ac4b990e791983fe973aae..4fc78ea785e1d5ed8641e86056dc9e2f44b0c086 100644 (file)
@@ -14,8 +14,8 @@ describe('MonitorService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(MonitorService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(MonitorService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index e5f039ff39e97243f15bdfae06b637f08747c4c3..a960500705a94797174c7fc56b2e4fd034a0cffb 100644 (file)
@@ -14,8 +14,8 @@ describe('NfsService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(NfsService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(NfsService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index e8ca64cd39773a2dd3803aac5867f81dbdde3ce8..41527a428ea36da72985b83bf5f3a90b3aa2e4eb 100644 (file)
@@ -15,8 +15,8 @@ describe('OrchestratorService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(OrchestratorService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(OrchestratorService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 44db3f5c85a206fbb2372c5a71ad350f4da23660..67a40b2091b5a6ba9edac6c4d2d995c5399aa0fa 100644 (file)
@@ -14,8 +14,8 @@ describe('OsdService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(OsdService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(OsdService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 5cb79a6dfcfba020eb923d8178b0c88adb61b998..46c07d402be4072c704d006dc5b403e4d527fbd6 100644 (file)
@@ -14,8 +14,8 @@ describe('PerformanceCounterService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(PerformanceCounterService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(PerformanceCounterService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 6450bc6ade29c6ba38ed65f514f2389cd9407ba5..197864d22a7d1fd803f2e37d52f2decea2abf8d5 100644 (file)
@@ -17,8 +17,8 @@ describe('PoolService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(PoolService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(PoolService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index f552a20134cca8e98e1cb6dba1b3a6462477e7d1..90feafc471429c16eef0bdea0976192f653f651a 100644 (file)
@@ -16,8 +16,8 @@ describe('PrometheusService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(PrometheusService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(PrometheusService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
@@ -175,7 +175,7 @@ describe('PrometheusService', () => {
 
     beforeEach(() => {
       x = false;
-      TestBed.get(SettingsService)['settings'] = {};
+      TestBed.inject(SettingsService)['settings'] = {};
       service.ifAlertmanagerConfigured(
         (v) => (x = v),
         () => (x = [])
@@ -216,7 +216,7 @@ describe('PrometheusService', () => {
 
     beforeEach(() => {
       x = false;
-      TestBed.get(SettingsService)['settings'] = {};
+      TestBed.inject(SettingsService)['settings'] = {};
       service.ifPrometheusConfigured(
         (v) => (x = v),
         () => (x = [])
index 2efa5a7998517549d6a052bcbac23768b6b83b9d..3f9a17ed09ac63c3375f2f01064a9f4ff01b87e2 100644 (file)
@@ -33,8 +33,8 @@ describe('RbdMirroringService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RbdMirroringService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(RbdMirroringService);
+    httpTesting = TestBed.inject(HttpTestingController);
     getMirroringSummaryCalls = () => {
       return httpTesting.match((request: HttpRequest<any>) => {
         return request.url.match(/api\/block\/mirroring\/summary/) && request.method === 'GET';
index c688e0f3f421a33ea2ea7edf53a5efd91040bcad..a9f3a36a437304636a39535a645c2c97a1a1b3f4 100644 (file)
@@ -16,8 +16,8 @@ describe('RbdService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RbdService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(RbdService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 0d342c48d1cd4f547647b00811158fd73fca3392..c7666da4c2ed6f113b7e3f7df68785af908670b3 100644 (file)
@@ -14,8 +14,8 @@ describe('RgwBucketService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RgwBucketService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(RgwBucketService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index b866333fde7f699bb982e759024ce108b14bc1df..9f85b04e3845ece3c6ff1c14e94e8130bdaf0b29 100644 (file)
@@ -14,8 +14,8 @@ describe('RgwDaemonService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RgwDaemonService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(RgwDaemonService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index a059c2f918840ce8ff65ba810cc400655ab58deb..d344c53b9d831361a4eca6dc8ff771f733d60f01 100644 (file)
@@ -14,8 +14,8 @@ describe('RgwSiteService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RgwSiteService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(RgwSiteService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 85aef0d07def4123b32387d205523184bcd87f60..271480c3dab2e44773cd3d8c15a203c3e73cbdcf 100644 (file)
@@ -16,8 +16,8 @@ describe('RgwUserService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RgwUserService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(RgwUserService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index c6ea8a009b5943edde693c024d2ffe7866ed9d25..c7edbbfd1e81a2cf4c138c6299d93967da98ee0e 100644 (file)
@@ -14,8 +14,8 @@ describe('RoleService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RoleService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(RoleService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 2016ff507e0e866c03bf632b7fd3b034ccc1ad11..23ec2b08d76984bc4949467af61693b59803e5eb 100644 (file)
@@ -14,8 +14,8 @@ describe('ScopeService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(ScopeService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(ScopeService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index dd73fe9cd0e2603dcd16f7d09e17cfad24a6b3a3..982f25bf92f735e17b94f73273f5e3c6a8b1a736 100644 (file)
@@ -17,8 +17,8 @@ describe('SettingsService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(SettingsService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(SettingsService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index d4d02a9bc5f651ec2e5d53cba1acb3e162ce8a7e..822610f441e7ac1e9cd0672b23ab23c6c088d42c 100644 (file)
@@ -14,8 +14,8 @@ describe('TelemetryService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(TelemetryService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(TelemetryService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 2dc813372a0a0f0863260770bf68ece61e67e134..8f50c0d8e826289fbcdd8d809f8a1547d00c70fb 100644 (file)
@@ -15,8 +15,8 @@ describe('UserService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(UserService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(UserService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 89019bf1d69a2a837ae8fa784a7715ead622f55f..b5510c6649f28d9e36c61ab5dff550ce6e38bd3c 100644 (file)
@@ -28,7 +28,7 @@ describe('ConfigOptionComponent', () => {
     fixture = TestBed.createComponent(ConfigOptionComponent);
     component = fixture.componentInstance;
     fixture.detectChanges();
-    configurationService = TestBed.get(ConfigurationService);
+    configurationService = TestBed.inject(ConfigurationService);
 
     const configOptions: Record<string, any> = [
       {
index f25c1ecdcd944183c88fb6a9ebfb1de3a8490ecb..ba77dc88ad1f47a6edd9d605a37e3a10ad13e617 100644 (file)
@@ -103,7 +103,7 @@ describe('ConfirmationModalComponent', () => {
     mockFixture = TestBed.createComponent(MockComponent);
     mockComponent = mockFixture.componentInstance;
     mockFixture.detectChanges();
-    modalService = TestBed.get(BsModalService);
+    modalService = TestBed.inject(BsModalService);
     spyOn(modalService, 'show').and.callFake((_modalComp, config) => {
       const data = modalServiceShow(ConfirmationModalComponent, config);
       fixture = data.fixture;
index 409f3b8a1a31242ce1e46c332411d39551c24ee3..7ac23f5695e1238239caababdf11ea36a7664b8e 100644 (file)
@@ -4,6 +4,7 @@ import { FormsModule } from '@angular/forms';
 import { RouterTestingModule } from '@angular/router/testing';
 
 import { AlertModule } from 'ngx-bootstrap/alert';
+import { of } from 'rxjs';
 
 import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
 import { SummaryService } from '../../../shared/services/summary.service';
@@ -45,7 +46,7 @@ describe('GrafanaComponent', () => {
 
   describe('with grafana initialized', () => {
     beforeEach(() => {
-      TestBed.get(SettingsService).settings = { 'api/grafana/url': 'http:localhost:3000' };
+      TestBed.inject(SettingsService)['settings'] = { 'api/grafana/url': 'http:localhost:3000' };
       fixture.detectChanges();
     });
 
@@ -76,7 +77,7 @@ describe('GrafanaComponent', () => {
     });
 
     it('should have Dashboard', () => {
-      TestBed.get(SettingsService).validateGrafanaDashboardUrl = { uid: 200 };
+      TestBed.inject(SettingsService).validateGrafanaDashboardUrl = () => of({ uid: 200 });
       expect(component.dashboardExist).toBe(true);
     });
   });
index a4b8aff265123b9325aa07adf4d2b3e20cdf6d32..2611962627c3b1e716266787caa39c994301a7d6 100644 (file)
@@ -75,7 +75,7 @@ describe('NotificationsSidebarComponent', () => {
     beforeEach(() => {
       prometheusReadPermission = 'read';
       configOptReadPermission = 'read';
-      spyOn(TestBed.get(AuthStorageService), 'getPermissions').and.callFake(
+      spyOn(TestBed.inject(AuthStorageService), 'getPermissions').and.callFake(
         () =>
           new Permissions({
             prometheus: [prometheusReadPermission],
@@ -83,12 +83,14 @@ describe('NotificationsSidebarComponent', () => {
           })
       );
 
-      spyOn(TestBed.get(PrometheusService), 'ifAlertmanagerConfigured').and.callFake((fn) => fn());
+      spyOn(TestBed.inject(PrometheusService), 'ifAlertmanagerConfigured').and.callFake((fn) =>
+        fn()
+      );
 
-      prometheusAlertService = TestBed.get(PrometheusAlertService);
+      prometheusAlertService = TestBed.inject(PrometheusAlertService);
       spyOn(prometheusAlertService, 'refresh').and.stub();
 
-      prometheusNotificationService = TestBed.get(PrometheusNotificationService);
+      prometheusNotificationService = TestBed.inject(PrometheusNotificationService);
       spyOn(prometheusNotificationService, 'refresh').and.stub();
     });
 
@@ -130,7 +132,7 @@ describe('NotificationsSidebarComponent', () => {
 
     beforeEach(() => {
       fixture.detectChanges();
-      summaryService = TestBed.get(SummaryService);
+      summaryService = TestBed.inject(SummaryService);
 
       spyOn(component, '_handleTasks').and.callThrough();
     });
@@ -150,7 +152,7 @@ describe('NotificationsSidebarComponent', () => {
 
   describe('Notifications', () => {
     it('should fetch latest notifications', fakeAsync(() => {
-      const notificationService: NotificationService = TestBed.get(NotificationService);
+      const notificationService: NotificationService = TestBed.inject(NotificationService);
       fixture.detectChanges();
 
       expect(component.notifications.length).toBe(0);
@@ -166,7 +168,7 @@ describe('NotificationsSidebarComponent', () => {
     let notificationService: NotificationService;
 
     beforeEach(() => {
-      notificationService = TestBed.get(NotificationService);
+      notificationService = TestBed.inject(NotificationService);
       fixture.detectChanges();
     });
 
index 3273a4e84f23d05ac36b39749c829f0bbc6a83a5..eb26601963a7e9961936000ebeabcc6f95fb9d51 100644 (file)
@@ -37,8 +37,8 @@ describe('PwdExpirationNotificationComponent', () => {
 
   describe('password expiration date has been set', () => {
     beforeEach(() => {
-      authStorageService = TestBed.get(AuthStorageService);
-      settingsService = TestBed.get(SettingsService);
+      authStorageService = TestBed.inject(AuthStorageService);
+      settingsService = TestBed.inject(SettingsService);
       spyOn(authStorageService, 'getPwdExpirationDate').and.returnValue(1645488000);
       spyOn(settingsService, 'getStandardSettings').and.returnValue(
         observableOf({
@@ -105,7 +105,7 @@ describe('PwdExpirationNotificationComponent', () => {
 
   describe('password expiration date has not been set', () => {
     beforeEach(() => {
-      authStorageService = TestBed.get(AuthStorageService);
+      authStorageService = TestBed.inject(AuthStorageService);
       spyOn(authStorageService, 'getPwdExpirationDate').and.returnValue(null);
       fixture = TestBed.createComponent(PwdExpirationNotificationComponent);
       component = fixture.componentInstance;
index bd4cc25058adb2eea63f97659e5de77d28cb272d..adbf5a223a9e7f8f37744ac1e7a145c8e97f1bc4 100644 (file)
@@ -36,7 +36,7 @@ describe('SelectBadgesComponent', () => {
       { name: 'option1', description: '', selected: false, enabled: true },
       { name: 'option2', description: '', selected: false, enabled: true }
     ];
-    const i18n = TestBed.get(I18n);
+    const i18n = TestBed.inject(I18n);
     const messages = new SelectMessages({ empty: 'foo bar' }, i18n);
     const selectionLimit = 2;
     const customBadges = true;
index 94a5d6f0f1bec0465ad6d8289202cb966b55114a..c25cb54404b9b04a9258db5fa3cbf3ae1fd7db06 100644 (file)
@@ -166,7 +166,7 @@ describe('TableKeyValueComponent', () => {
     let datePipe: CdDatePipe;
 
     beforeEach(() => {
-      datePipe = TestBed.get(CdDatePipe);
+      datePipe = TestBed.inject(CdDatePipe);
       spyOn(datePipe, 'transform').and.callThrough();
     });
 
index 37fca45264e6572291498f99166c9006b8bb6c7d..e4f09edd03c19bf8b2681f0c210c0bc23b3617ec 100644 (file)
@@ -11,7 +11,7 @@ describe('Copy2clipboardButtonDirective', () => {
   });
 
   it('should create an instance', () => {
-    const i18n = TestBed.get(I18n);
+    const i18n = TestBed.inject(I18n);
     const directive = new Copy2ClipboardButtonDirective(null, null, null, i18n);
     expect(directive).toBeTruthy();
   });
index a5d4667a15e599e60e8714e9b78b2af72eb0e7a0..df6b49293966af1dbb181964933d544b51cac52e 100644 (file)
@@ -13,7 +13,7 @@ describe('BooleanTextPipe', () => {
   });
 
   beforeEach(() => {
-    const i18n = TestBed.get(I18n);
+    const i18n = TestBed.inject(I18n);
     pipe = new BooleanTextPipe(i18n);
   });
 
index 14a6fd064ce8615160ea750c7efe6dbedb22268a..f658365e2d2ae6e0e6a7ee88064a84f3127982f4 100644 (file)
@@ -13,7 +13,7 @@ describe('NotAvailablePipe', () => {
   });
 
   beforeEach(() => {
-    const i18n = TestBed.get(I18n);
+    const i18n = TestBed.inject(I18n);
     pipe = new NotAvailablePipe(i18n);
   });
 
index 8c6ec61743ddadf8cde25bde0f505e2357b9a356..6ed7153ac6af72733a9b6a6bf844dfb0cb6798cc 100644 (file)
@@ -76,19 +76,19 @@ describe('ApiInterceptorService', () => {
     const baseTime = new Date('2022-02-22');
     spyOn(global, 'Date').and.returnValue(baseTime);
 
-    httpClient = TestBed.get(HttpClient);
-    httpTesting = TestBed.get(HttpTestingController);
+    httpClient = TestBed.inject(HttpClient);
+    httpTesting = TestBed.inject(HttpTestingController);
 
-    notificationService = TestBed.get(NotificationService);
+    notificationService = TestBed.inject(NotificationService);
     spyOn(notificationService, 'show').and.callThrough();
     spyOn(notificationService, 'save');
 
-    router = TestBed.get(Router);
+    router = TestBed.inject(Router);
     spyOn(router, 'navigate');
   });
 
   it('should be created', () => {
-    const service = TestBed.get(ApiInterceptorService);
+    const service = TestBed.inject(ApiInterceptorService);
     expect(service).toBeTruthy();
   });
 
index f23d7dc267009ac99dc4a2b18960c9b415e331a9..e086ecc259cb851cddf20f8c54f3d60d87332d64 100644 (file)
@@ -24,9 +24,9 @@ describe('AuthGuardService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(AuthGuardService);
-    authStorageService = TestBed.get(AuthStorageService);
-    ngZone = TestBed.get(NgZone);
+    service = TestBed.inject(AuthGuardService);
+    authStorageService = TestBed.inject(AuthStorageService);
+    ngZone = TestBed.inject(NgZone);
   });
 
   it('should be created', () => {
@@ -39,7 +39,7 @@ describe('AuthGuardService', () => {
   });
 
   it('should prevent user if not loggedIn and redirect to login page', fakeAsync(() => {
-    const router = TestBed.get(Router);
+    const router = TestBed.inject(Router);
     ngZone.run(() => {
       expect(service.canActivate()).toBe(false);
     });
index 0a446b6052c24441ce3bd3d1da724d16eff68753..a31e79c373cf7e810f7b0b2567a938e18f3a4641 100644 (file)
@@ -24,9 +24,9 @@ describe('ChangePasswordGuardService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(ChangePasswordGuardService);
-    authStorageService = TestBed.get(AuthStorageService);
-    ngZone = TestBed.get(NgZone);
+    service = TestBed.inject(ChangePasswordGuardService);
+    authStorageService = TestBed.inject(AuthStorageService);
+    ngZone = TestBed.inject(NgZone);
   });
 
   it('should be created', () => {
@@ -54,7 +54,7 @@ describe('ChangePasswordGuardService', () => {
     spyOn(authStorageService, 'isLoggedIn').and.returnValue(true);
     spyOn(authStorageService, 'isSSO').and.returnValue(false);
     spyOn(authStorageService, 'getPwdUpdateRequired').and.returnValue(true);
-    const router = TestBed.get(Router);
+    const router = TestBed.inject(Router);
     ngZone.run(() => {
       expect(service.canActivate()).toBeFalsy();
     });
index 7114f283a15e7d7d8d54accf7cba56eacab1d6d1..bb82707ab1a289da072c95fcb983a61b66379bf5 100644 (file)
@@ -14,7 +14,7 @@ describe('DepCheckerService', () => {
   });
 
   it('should be created', () => {
-    const service: DepCheckerService = TestBed.get(DepCheckerService);
+    const service: DepCheckerService = TestBed.inject(DepCheckerService);
     expect(service).toBeTruthy();
   });
 });
index ed8260761f83b6b174577eeb10c9c6321b6c0cb9..e9b41b1a9f308ba3d7c2583213e1e2eaf83559a0 100644 (file)
@@ -10,7 +10,7 @@ describe('DeviceService', () => {
 
   beforeEach(() => {
     TestBed.configureTestingModule({});
-    service = TestBed.get(DeviceService);
+    service = TestBed.inject(DeviceService);
   });
 
   it('should be created', () => {
index 474926ce952f039b89ca032e8f0acd43f50674f1..06db9040444ee5180d8d3683b3ef6a54d88f477f 100644 (file)
@@ -36,10 +36,10 @@ describe('FeatureTogglesGuardService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(FeatureTogglesGuardService);
-    fakeFeatureTogglesService = TestBed.get(FeatureTogglesService);
-    ngZone = TestBed.get(NgZone);
-    router = TestBed.get(Router);
+    service = TestBed.inject(FeatureTogglesGuardService);
+    fakeFeatureTogglesService = TestBed.inject(FeatureTogglesService);
+    ngZone = TestBed.inject(NgZone);
+    router = TestBed.inject(Router);
   });
 
   it('should be created', () => {
index 8ad0a15e60c5d353dfc01545f70403718ccd6fed..1b888b8179dd97c5193eea280cb6b20ae0c14998 100644 (file)
@@ -14,8 +14,8 @@ describe('FeatureTogglesService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(FeatureTogglesService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(FeatureTogglesService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index 5c4ad820a862ff67d425c0d11c2b11d1d077898d..f2fa0bf196b1a216957b4bbdd9c796741b975604 100644 (file)
@@ -14,8 +14,8 @@ describe('LanguageService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(LanguageService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(LanguageService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
index f1fbcd38baba986f7dddfcd749f909c5d91d68e4..66d0e1bd7db5d8f1bc40094db54c22eddd77f24e 100644 (file)
@@ -46,9 +46,9 @@ describe('ModuleStatusGuardService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(ModuleStatusGuardService);
-    httpClient = TestBed.get(HttpClient);
-    router = TestBed.get(Router);
+    service = TestBed.inject(ModuleStatusGuardService);
+    httpClient = TestBed.inject(HttpClient);
+    router = TestBed.inject(Router);
     route = new ActivatedRouteSnapshot();
     route.url = [];
     route.data = {
@@ -57,7 +57,7 @@ describe('ModuleStatusGuardService', () => {
         redirectTo: '/foo'
       }
     };
-    ngZone = TestBed.get(NgZone);
+    ngZone = TestBed.inject(NgZone);
   });
 
   it('should be created', () => {
index 76bbd4fe0b6dbd9755ef630dc5b86cbb57191dbc..d50b957dd854206f0e92280f4886f597b4cb9653 100644 (file)
@@ -25,10 +25,10 @@ describe('NoSsoGuardService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(NoSsoGuardService);
-    authStorageService = TestBed.get(AuthStorageService);
-    ngZone = TestBed.get(NgZone);
-    router = TestBed.get(Router);
+    service = TestBed.inject(NoSsoGuardService);
+    authStorageService = TestBed.inject(AuthStorageService);
+    ngZone = TestBed.inject(NgZone);
+    router = TestBed.inject(Router);
   });
 
   it('should be created', () => {
index da48ac0fbe6b98ebcea8fa2d6a55d5e766e9f434..9d3fdc56356ee423222ea1e20e8619f8256463b5 100644 (file)
@@ -34,7 +34,7 @@ describe('NotificationService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(NotificationService);
+    service = TestBed.inject(NotificationService);
     service.removeAll();
   });
 
@@ -233,7 +233,7 @@ describe('NotificationService', () => {
       spyOn(global, 'Date').and.returnValue(baseTime);
       spyOn(window, 'setTimeout').and.callFake((fn) => fn());
 
-      toastr = TestBed.get(ToastrService);
+      toastr = TestBed.inject(ToastrService);
       // spyOn needs to know the methods before spying and can't read the array for clarification
       ['error', 'info', 'success'].forEach((method: 'error' | 'info' | 'success') =>
         spyOn(toastr, method).and.stub()
index 23d0e6651190b98d2aba218d83a55120bd27c107..cae1993b58b28e0b0b8614c94a071d090943301d 100644 (file)
@@ -38,8 +38,8 @@ describe('PasswordPolicyService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(PasswordPolicyService);
-    settingsService = TestBed.get(SettingsService);
+    service = TestBed.inject(PasswordPolicyService);
+    settingsService = TestBed.inject(SettingsService);
     settingsService['settings'] = {};
   });
 
index dfd43778f73d54df4006c8978d18708be17c2bb1..02a7baefad32f3c3da1db5ad744ba7a3853c848c 100644 (file)
@@ -27,8 +27,8 @@ describe('PrometheusAlertFormatter', () => {
 
   beforeEach(() => {
     prometheus = new PrometheusHelper();
-    service = TestBed.get(PrometheusAlertFormatter);
-    notificationService = TestBed.get(NotificationService);
+    service = TestBed.inject(PrometheusAlertFormatter);
+    notificationService = TestBed.inject(NotificationService);
     spyOn(notificationService, 'show').and.stub();
   });
 
index 8bf4c41a822276a3ca6a788c5efef55d52b047b5..f2235f53953e1f1154bcf6a6efd9b6a47da5dc3e 100644 (file)
@@ -35,13 +35,13 @@ describe('PrometheusAlertService', () => {
   });
 
   it('should create', () => {
-    expect(TestBed.get(PrometheusAlertService)).toBeTruthy();
+    expect(TestBed.inject(PrometheusAlertService)).toBeTruthy();
   });
 
   describe('test failing status codes and verify disabling of the alertmanager', () => {
     const isDisabledByStatusCode = (statusCode: number, expectedStatus: boolean, done: any) => {
-      service = TestBed.get(PrometheusAlertService);
-      prometheusService = TestBed.get(PrometheusService);
+      service = TestBed.inject(PrometheusAlertService);
+      prometheusService = TestBed.inject(PrometheusService);
       spyOn(prometheusService, 'ifAlertmanagerConfigured').and.callFake((fn) => fn());
       spyOn(prometheusService, 'getAlerts').and.returnValue(
         Observable.create((observer: any) => observer.error({ status: statusCode, error: {} }))
@@ -73,8 +73,8 @@ describe('PrometheusAlertService', () => {
   });
 
   it('should flatten the response of getRules()', () => {
-    service = TestBed.get(PrometheusAlertService);
-    prometheusService = TestBed.get(PrometheusService);
+    service = TestBed.inject(PrometheusAlertService);
+    prometheusService = TestBed.inject(PrometheusService);
 
     spyOn(service['prometheusService'], 'ifPrometheusConfigured').and.callFake((fn) => fn());
     spyOn(prometheusService, 'getRules').and.returnValue(
@@ -108,16 +108,16 @@ describe('PrometheusAlertService', () => {
 
   describe('refresh', () => {
     beforeEach(() => {
-      service = TestBed.get(PrometheusAlertService);
+      service = TestBed.inject(PrometheusAlertService);
       service['alerts'] = [];
       service['canAlertsBeNotified'] = false;
 
       spyOn(window, 'setTimeout').and.callFake((fn: Function) => fn());
 
-      notificationService = TestBed.get(NotificationService);
+      notificationService = TestBed.inject(NotificationService);
       spyOn(notificationService, 'show').and.stub();
 
-      prometheusService = TestBed.get(PrometheusService);
+      prometheusService = TestBed.inject(PrometheusService);
       spyOn(prometheusService, 'ifAlertmanagerConfigured').and.callFake((fn) => fn());
       spyOn(prometheusService, 'getAlerts').and.callFake(() => of(alerts));
 
index 9e5e09a23038698b9013af37bb7058a65e7b51fb..de3130a9dc8d87c07155e989af9d1ddfd61848ae 100644 (file)
@@ -46,17 +46,17 @@ describe('PrometheusNotificationService', () => {
   beforeEach(() => {
     prometheus = new PrometheusHelper();
 
-    service = TestBed.get(PrometheusNotificationService);
+    service = TestBed.inject(PrometheusNotificationService);
     service['notifications'] = [];
 
-    notificationService = TestBed.get(NotificationService);
+    notificationService = TestBed.inject(NotificationService);
     shown = [];
     spyOn(notificationService, 'show').and.callThrough();
     spyOn(notificationService, 'save').and.callFake((n) => shown.push(n));
 
     spyOn(window, 'setTimeout').and.callFake((fn: Function) => fn());
 
-    prometheusService = TestBed.get(PrometheusService);
+    prometheusService = TestBed.inject(PrometheusService);
     getNotificationSinceMock = () => of(notifications);
     spyOn(prometheusService, 'getNotifications').and.callFake(() => getNotificationSinceMock());
 
index 6ac93140243142a97677ca9632a119bef7bb131d..5e92b52a59eb6b1b8fce56413fd980e4f6469c6b 100644 (file)
@@ -27,7 +27,7 @@ describe('PrometheusSilenceMatcherService', () => {
 
   beforeEach(() => {
     prometheus = new PrometheusHelper();
-    service = TestBed.get(PrometheusSilenceMatcherService);
+    service = TestBed.inject(PrometheusSilenceMatcherService);
     rules = [
       prometheus.createRule('alert0', 'someSeverity', [prometheus.createAlert('alert0')]),
       prometheus.createRule('alert1', 'someSeverity', []),
index 3b9c0437aaf9e167b683103a81d19e1db36b0d03..e1db61a5ebb334fa58b79ecbdb87500d37671d1a 100644 (file)
@@ -12,7 +12,7 @@ describe('RbdConfigurationService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RbdConfigurationService);
+    service = TestBed.inject(RbdConfigurationService);
   });
 
   it('should be created', () => {
index 4d34ce0a9653c5776efb2eb205c18bf48524d677..1d11fc5561fbecc26008557cad250d2bc365f82f 100644 (file)
@@ -13,7 +13,7 @@ describe('RefreshIntervalService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(RefreshIntervalService);
+    service = TestBed.inject(RefreshIntervalService);
   });
 
   it('should be created', () => {
@@ -22,7 +22,7 @@ describe('RefreshIntervalService', () => {
 
   it('should initial private interval time right', () => {
     sessionStorage.setItem('dashboard_interval', '10000');
-    const ngZone = TestBed.get(NgZone);
+    const ngZone = TestBed.inject(NgZone);
     service = new RefreshIntervalService(ngZone);
     expect(service.getRefreshInterval()).toBe(10000);
   });
index 14144921ef1819156a6227d351fd6558ee7d0636..8b8517002067f5dc142a427675fdac21ca1c23d4 100644 (file)
@@ -42,8 +42,8 @@ describe('SummaryService', () => {
   });
 
   beforeEach(() => {
-    summaryService = TestBed.get(SummaryService);
-    authStorageService = TestBed.get(AuthStorageService);
+    summaryService = TestBed.inject(SummaryService);
+    authStorageService = TestBed.inject(AuthStorageService);
   });
 
   it('should be created', () => {
index b25766f95c0c1ccec0dbf5a61e8ccf4b00f12f23..e52459b0b855d6b0e309987a82f97987f2fd0349 100644 (file)
@@ -34,9 +34,9 @@ describe('TaskListService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(TaskListService);
-    summaryService = TestBed.get(SummaryService);
-    taskMessageService = TestBed.get(TaskMessageService);
+    service = TestBed.inject(TaskListService);
+    summaryService = TestBed.inject(SummaryService);
+    taskMessageService = TestBed.inject(TaskMessageService);
     summaryService['summaryDataSource'].next({ executing_tasks: [] });
 
     taskMessageService.messages['test/create'] = taskMessageService.messages['rbd/create'];
index be83c323c704bb711d3320c22a042aec31a8216f..9a951169d639b036ed922b91791da74bde49f0ee 100644 (file)
@@ -40,8 +40,8 @@ describe('TaskManagerService', () => {
   });
 
   beforeEach(() => {
-    taskManagerService = TestBed.get(TaskManagerService);
-    summaryService = TestBed.get(SummaryService);
+    taskManagerService = TestBed.inject(TaskManagerService);
+    summaryService = TestBed.inject(SummaryService);
     called = false;
     taskManagerService.subscribe('foo', {}, () => (called = true));
   });
index 667bef7da59033943ce332c7065ccf97f74f8433..192e46d39dd3bf0394cdac4bd5b218915711b5f2 100644 (file)
@@ -19,7 +19,7 @@ describe('TaskManagerMessageService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(TaskMessageService);
+    service = TestBed.inject(TaskMessageService);
     finishedTask = new FinishedTask();
     finishedTask.duration = 30;
   });
index 93800260d651036adbe297bdc58461b4de5926e8..f039af4fd89dadd01814135ff2196788aebc347c 100644 (file)
@@ -52,8 +52,8 @@ describe('TaskWrapperService', () => {
 
     beforeEach(() => {
       passed = false;
-      notify = TestBed.get(NotificationService);
-      summaryService = TestBed.get(SummaryService);
+      notify = TestBed.inject(NotificationService);
+      summaryService = TestBed.inject(SummaryService);
       spyOn(notify, 'show');
       spyOn(notify, 'notifyTask').and.stub();
       spyOn(service, '_handleExecutingTasks').and.callThrough();
@@ -75,7 +75,7 @@ describe('TaskWrapperService', () => {
     });
 
     it('should call notifyTask if asynchronous task would have been finished', () => {
-      const taskManager = TestBed.get(TaskManagerService);
+      const taskManager = TestBed.inject(TaskManagerService);
       spyOn(taskManager, 'subscribe').and.callFake((_name, _metadata, onTaskFinished) => {
         onTaskFinished();
       });
index 871c1afa3035304d908bab42a402e3725f58d50d..e974f2d552513252809f6c8a29b0c9880489414d 100644 (file)
@@ -11,7 +11,7 @@ describe('TextToDownloadService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(TextToDownloadService);
+    service = TestBed.inject(TextToDownloadService);
   });
 
   it('should be created', () => {
index 8909ca8edf62ca33c5dd06550fdc91d684065a86..aa31d14ff0cec5ddc38d9078d543457ae5eecc2a 100644 (file)
@@ -12,7 +12,7 @@ describe('TimeDiffService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(TimeDiffService);
+    service = TestBed.inject(TimeDiffService);
   });
 
   it('should be created', () => {
index 641fa717db691a49dd889f1c9f23563e2938a81b..496f4ac9bd9ffeff9ffdc1f036a6dfd295a87047 100644 (file)
@@ -19,7 +19,7 @@ describe('TimerService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(TimerService);
+    service = TestBed.inject(TimerService);
     receivedData = [];
   });
 
index fafbf60b4c6dc082837654f92041a9c0bd8e6b8e..e217838600c47dc19664d78a31b4a81f59272fcf 100644 (file)
@@ -1,15 +1,18 @@
+import { ActivatedRoute } from '@angular/router';
+
 import { ReplaySubject } from 'rxjs';
 
 /**
  * An ActivateRoute test double with a `params` observable.
  * Use the `setParams()` method to add the next `params` value.
  */
-export class ActivatedRouteStub {
+export class ActivatedRouteStub extends ActivatedRoute {
   // Use a ReplaySubject to share previous values with subscribers
   // and pump new values into the `params` observable
   private subject = new ReplaySubject<object>();
 
   constructor(initialParams?: object) {
+    super();
     this.setParams(initialParams);
   }