Search in sources :

Example 21 with MetaDataDO

use of org.apache.shenyu.admin.model.entity.MetaDataDO in project incubator-shenyu by apache.

the class ShenyuClientRegisterMotanServiceImplTest method testRegisterMetadata.

@Test
public void testRegisterMetadata() {
    MetaDataDO metaDataDO = MetaDataDO.builder().build();
    when(metaDataService.findByPath(any())).thenReturn(metaDataDO);
    MetaDataRegisterDTO metaDataDTO = MetaDataRegisterDTO.builder().build();
    shenyuClientRegisterMotanService.registerMetadata(metaDataDTO);
    verify(metaDataService).saveOrUpdateMetaData(metaDataDO, metaDataDTO);
}
Also used : MetaDataRegisterDTO(org.apache.shenyu.register.common.dto.MetaDataRegisterDTO) MetaDataDO(org.apache.shenyu.admin.model.entity.MetaDataDO) Test(org.junit.jupiter.api.Test)

Example 22 with MetaDataDO

use of org.apache.shenyu.admin.model.entity.MetaDataDO in project incubator-shenyu by apache.

the class ShenyuClientRegisterTarsServiceImplTest method testRegisterMetadata.

@Test
public void testRegisterMetadata() {
    MetaDataDO metaDataDO = MetaDataDO.builder().build();
    String serviceName = "metaDataService";
    String methodName = "registerMetadata";
    when(metaDataService.findByServiceNameAndMethodName(any(), any())).thenReturn(metaDataDO);
    MetaDataRegisterDTO metaDataDTO = MetaDataRegisterDTO.builder().serviceName(serviceName).methodName(methodName).build();
    shenyuClientRegisterTarsService.registerMetadata(metaDataDTO);
    verify(metaDataService).findByServiceNameAndMethodName(serviceName, methodName);
    verify(metaDataService).saveOrUpdateMetaData(metaDataDO, metaDataDTO);
}
Also used : MetaDataRegisterDTO(org.apache.shenyu.register.common.dto.MetaDataRegisterDTO) MetaDataDO(org.apache.shenyu.admin.model.entity.MetaDataDO) Test(org.junit.jupiter.api.Test)

Example 23 with MetaDataDO

use of org.apache.shenyu.admin.model.entity.MetaDataDO in project incubator-shenyu by apache.

the class ShenyuClientRegisterDivideServiceImplTest method testRegisterMetadata.

@Test
public void testRegisterMetadata() {
    MetaDataDO metaDataDO = MetaDataDO.builder().build();
    when(metaDataService.findByPath(any())).thenReturn(metaDataDO);
    MetaDataRegisterDTO metaDataDTO = MetaDataRegisterDTO.builder().registerMetaData(true).build();
    shenyuClientRegisterDivideService.registerMetadata(metaDataDTO);
    verify(metaDataService).saveOrUpdateMetaData(metaDataDO, metaDataDTO);
}
Also used : MetaDataRegisterDTO(org.apache.shenyu.register.common.dto.MetaDataRegisterDTO) MetaDataDO(org.apache.shenyu.admin.model.entity.MetaDataDO) Test(org.junit.jupiter.api.Test)

Example 24 with MetaDataDO

use of org.apache.shenyu.admin.model.entity.MetaDataDO in project incubator-shenyu by apache.

the class MetaDataServiceTest method testCreateOrUpdateForUpdate.

/**
 * Cases where check passed and update operation.<br>
 * The stub declared in createOrUpdateCase1 and createOrUpdateCase3 will not be repeated.
 */
private void testCreateOrUpdateForUpdate() {
    MetaDataDO metaDataDO = MetaDataDO.builder().build();
    when(metaDataDTO.getId()).thenReturn("id");
    when(metaDataMapper.selectById("id")).thenReturn(null).thenReturn(metaDataDO);
    when(metaDataMapper.update(any())).thenReturn(1);
    String msg = metaDataService.createOrUpdate(metaDataDTO);
    assertEquals(StringUtils.EMPTY, msg);
}
Also used : MetaDataDO(org.apache.shenyu.admin.model.entity.MetaDataDO) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString)

Example 25 with MetaDataDO

use of org.apache.shenyu.admin.model.entity.MetaDataDO in project incubator-shenyu by apache.

the class ShenyuClientRegisterSofaServiceImplTest method testRegisterMetadata.

@Test
public void testRegisterMetadata() {
    MetaDataDO metaDataDO = MetaDataDO.builder().build();
    when(metaDataService.findByServiceNameAndMethodName(any(), any())).thenReturn(metaDataDO);
    MetaDataRegisterDTO metaDataDTO = MetaDataRegisterDTO.builder().build();
    shenyuClientRegisterSofaService.registerMetadata(metaDataDTO);
    verify(metaDataService).saveOrUpdateMetaData(metaDataDO, metaDataDTO);
}
Also used : MetaDataRegisterDTO(org.apache.shenyu.register.common.dto.MetaDataRegisterDTO) MetaDataDO(org.apache.shenyu.admin.model.entity.MetaDataDO) Test(org.junit.jupiter.api.Test)

Aggregations

MetaDataDO (org.apache.shenyu.admin.model.entity.MetaDataDO)36 Test (org.junit.jupiter.api.Test)23 AbstractSpringIntegrationTest (org.apache.shenyu.admin.AbstractSpringIntegrationTest)14 MetaDataService (org.apache.shenyu.admin.service.MetaDataService)7 MetaDataRegisterDTO (org.apache.shenyu.register.common.dto.MetaDataRegisterDTO)7 DataChangedEvent (org.apache.shenyu.admin.listener.DataChangedEvent)4 PageParameter (org.apache.shenyu.admin.model.page.PageParameter)3 Timestamp (java.sql.Timestamp)2 MetaDataQuery (org.apache.shenyu.admin.model.query.MetaDataQuery)2 MetaDataVO (org.apache.shenyu.admin.model.vo.MetaDataVO)2 MetaDataTransfer (org.apache.shenyu.admin.transfer.MetaDataTransfer)2 MetaData (org.apache.shenyu.common.dto.MetaData)2 DataEventTypeEnum (org.apache.shenyu.common.enums.DataEventTypeEnum)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ArrayList (java.util.ArrayList)1 Transactional (org.springframework.transaction.annotation.Transactional)1