Search in sources :

Example 11 with Capacity

use of com.alibaba.nacos.config.server.model.capacity.Capacity in project nacos by alibaba.

the class GroupCapacityPersistServiceTest method testGetClusterCapacity.

@Test
public void testGetClusterCapacity() {
    List<GroupCapacity> list = new ArrayList<>();
    GroupCapacity groupCapacity = new GroupCapacity();
    groupCapacity.setId(1L);
    list.add(groupCapacity);
    String groupId = GroupCapacityPersistService.CLUSTER;
    when(jdbcTemplate.query(anyString(), eq(new Object[] { groupId }), any(RowMapper.class))).thenReturn(list);
    Capacity ret = service.getClusterCapacity();
    Assert.assertEquals(groupCapacity.getId(), ret.getId());
}
Also used : GroupCapacity(com.alibaba.nacos.config.server.model.capacity.GroupCapacity) Capacity(com.alibaba.nacos.config.server.model.capacity.Capacity) GroupCapacity(com.alibaba.nacos.config.server.model.capacity.GroupCapacity) ArrayList(java.util.ArrayList) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) RowMapper(org.springframework.jdbc.core.RowMapper) Test(org.junit.Test)

Aggregations

Capacity (com.alibaba.nacos.config.server.model.capacity.Capacity)11 GroupCapacity (com.alibaba.nacos.config.server.model.capacity.GroupCapacity)7 TenantCapacity (com.alibaba.nacos.config.server.model.capacity.TenantCapacity)4 Test (org.junit.Test)4 Timestamp (java.sql.Timestamp)2 RowMapper (org.springframework.jdbc.core.RowMapper)2 RestResult (com.alibaba.nacos.common.model.RestResult)1 CollectionUtils (com.alibaba.nacos.common.utils.CollectionUtils)1 DataSourceService (com.alibaba.nacos.config.server.service.datasource.DataSourceService)1 DynamicDataSource (com.alibaba.nacos.config.server.service.datasource.DynamicDataSource)1 FATAL_LOG (com.alibaba.nacos.config.server.utils.LogUtil.FATAL_LOG)1 PropertyUtil (com.alibaba.nacos.config.server.utils.PropertyUtil)1 TimeUtils (com.alibaba.nacos.config.server.utils.TimeUtils)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 PostConstruct (javax.annotation.PostConstruct)1