Search in sources :

Example 21 with TenantCapacity

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

the class TenantCapacityPersistServiceTest method testIncrementUsageWithQuotaLimit.

@Test
public void testIncrementUsageWithQuotaLimit() {
    TenantCapacity tenantCapacity = new TenantCapacity();
    Timestamp timestamp = new Timestamp(System.currentTimeMillis());
    tenantCapacity.setGmtModified(timestamp);
    tenantCapacity.setTenant("test2");
    when(jdbcTemplate.update(anyString(), eq(timestamp), eq("test2"))).thenReturn(1);
    Assert.assertTrue(service.incrementUsageWithQuotaLimit(tenantCapacity));
}
Also used : TenantCapacity(com.alibaba.nacos.config.server.model.capacity.TenantCapacity) Timestamp(java.sql.Timestamp) Test(org.junit.Test)

Aggregations

TenantCapacity (com.alibaba.nacos.config.server.model.capacity.TenantCapacity)21 Test (org.junit.Test)17 Timestamp (java.sql.Timestamp)7 GroupCapacity (com.alibaba.nacos.config.server.model.capacity.GroupCapacity)6 ArrayList (java.util.ArrayList)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 RowMapper (org.springframework.jdbc.core.RowMapper)3 Capacity (com.alibaba.nacos.config.server.model.capacity.Capacity)2 PreparedStatementCreator (org.springframework.jdbc.core.PreparedStatementCreator)2 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 HashMap (java.util.HashMap)1