34 changed files with 274 additions and 110 deletions
@ -0,0 +1,55 @@ |
|||
/** |
|||
* Copyright © 2016-2024 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.service; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.junit.Test; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.thingsboard.server.common.data.EntityType; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.dao.Dao; |
|||
import org.thingsboard.server.dao.entity.EntityDaoRegistry; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
import static org.assertj.core.api.Assertions.assertThat; |
|||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
|||
|
|||
@Slf4j |
|||
@DaoSqlTest |
|||
public class EntityDaoRegistryTest extends AbstractServiceTest { |
|||
|
|||
@Autowired |
|||
EntityDaoRegistry entityDaoRegistry; |
|||
|
|||
@Test |
|||
public void givenAllEntityTypes_whenGetDao_thenAllPresent() { |
|||
for (EntityType entityType : EntityType.values()) { |
|||
Dao<?> dao = assertDoesNotThrow(() -> entityDaoRegistry.getDao(entityType)); |
|||
assertThat(dao).isNotNull(); |
|||
} |
|||
} |
|||
|
|||
@Test |
|||
public void givenAllDaos_whenFindById_thenOk() { |
|||
for (EntityType entityType : EntityType.values()) { |
|||
assertDoesNotThrow(() -> { |
|||
entityDaoRegistry.getDao(entityType).findById(TenantId.SYS_TENANT_ID, UUID.randomUUID()); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue