4 changed files with 49 additions and 46 deletions
@ -0,0 +1,46 @@ |
|||||
|
package com.project.interaction.controller; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollUtil; |
||||
|
import com.project.information.domain.dto.KnowledgePointDTO; |
||||
|
import com.project.information.domain.entity.KnowledgePointEntity; |
||||
|
import com.project.information.domain.service.KnowledgePointBaseService; |
||||
|
import com.project.interaction.application.AlgorithmApplicationService; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.junit.runner.RunWith; |
||||
|
import org.mockito.internal.util.collections.Sets; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
import org.springframework.test.context.ActiveProfiles; |
||||
|
import org.springframework.test.context.junit4.SpringRunner; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
import static org.junit.jupiter.api.Assertions.*; |
||||
|
|
||||
|
@SpringBootTest |
||||
|
@RunWith(SpringRunner.class) |
||||
|
@ActiveProfiles("test") |
||||
|
class InteractionControllerTest { |
||||
|
|
||||
|
@Autowired |
||||
|
private AlgorithmApplicationService algorithmApplicationService; |
||||
|
@Autowired |
||||
|
private KnowledgePointBaseService knowledgePointBaseService; |
||||
|
|
||||
|
@Test |
||||
|
public void test(){ |
||||
|
Set<Long> idSet = Sets.newSet( |
||||
|
708018904630296576L |
||||
|
); |
||||
|
for (Long id : idSet) { |
||||
|
List<KnowledgePointDTO> list = knowledgePointBaseService.lambdaQuery() |
||||
|
.eq(KnowledgePointEntity::getInformationId, id).list().stream() |
||||
|
.map(entity -> entity.toDTO(KnowledgePointDTO::new)).toList(); |
||||
|
if (CollUtil.isNotEmpty(list)) { |
||||
|
algorithmApplicationService.postToClusteringByInformationId(id , list); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue