Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiyue1102 committed Sep 18, 2024
1 parent f721edc commit d7ef024
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.alibaba.nacos.config.server.service;

import com.alibaba.nacos.config.server.constant.PropertiesConstant;
import com.alibaba.nacos.config.server.service.capacity.TenantCapacityPersistService;
import com.alibaba.nacos.config.server.service.repository.ConfigInfoPersistService;
import com.alibaba.nacos.core.namespace.injector.AbstractNamespaceDetailInjector;
import com.alibaba.nacos.core.namespace.model.Namespace;
Expand All @@ -34,12 +33,8 @@ public class NamespaceConfigInfoService extends AbstractNamespaceDetailInjector

private final ConfigInfoPersistService configInfoPersistService;

private final TenantCapacityPersistService tenantCapacityPersistService;

public NamespaceConfigInfoService(ConfigInfoPersistService configInfoPersistService,
TenantCapacityPersistService tenantCapacityPersistService) {
public NamespaceConfigInfoService(ConfigInfoPersistService configInfoPersistService) {
this.configInfoPersistService = configInfoPersistService;
this.tenantCapacityPersistService = tenantCapacityPersistService;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ public class NamespaceConfigInfoServiceTest {
@Mock
private ConfigInfoPersistService configInfoPersistService;

@Mock
private TenantCapacityPersistService tenantCapacityPersistService;

MockedStatic<PropertyUtil> propertyUtilMockedStatic;

@BeforeEach
Expand All @@ -62,11 +59,9 @@ public void testInjectDetailNotDefault() {
TenantCapacity tenantCapacity = new TenantCapacity();
tenantCapacity.setQuota(1023);

when(tenantCapacityPersistService.getTenantCapacity(namespaceId)).thenReturn(tenantCapacity);
when(configInfoPersistService.configInfoCount(namespaceId)).thenReturn(101);
Namespace namespace = new Namespace(namespaceId, "test123ShowName");
NamespaceConfigInfoService namespaceConfigInfoService = new NamespaceConfigInfoService(configInfoPersistService,
tenantCapacityPersistService);
NamespaceConfigInfoService namespaceConfigInfoService = new NamespaceConfigInfoService(configInfoPersistService);
namespaceConfigInfoService.injectDetail(namespace);
assertEquals(101, namespace.getConfigCount());
assertEquals(1023, namespace.getQuota());
Expand All @@ -79,13 +74,11 @@ public void testInjectDetailDefaultQuota() {
String namespaceId = "test1234";
TenantCapacity tenantCapacity = new TenantCapacity();
tenantCapacity.setQuota(0);
when(tenantCapacityPersistService.getTenantCapacity(namespaceId)).thenReturn(tenantCapacity);
when(configInfoPersistService.configInfoCount(namespaceId)).thenReturn(105);

when(PropertyUtil.getDefaultTenantQuota()).thenReturn(1025);
Namespace namespace = new Namespace(namespaceId, "test123ShowName");
NamespaceConfigInfoService namespaceConfigInfoService = new NamespaceConfigInfoService(configInfoPersistService,
tenantCapacityPersistService);
NamespaceConfigInfoService namespaceConfigInfoService = new NamespaceConfigInfoService(configInfoPersistService);
namespaceConfigInfoService.injectDetail(namespace);

assertEquals(105, namespace.getConfigCount());
Expand Down

0 comments on commit d7ef024

Please sign in to comment.