mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 22:46:49 +00:00
(improvement)(headless) Fix Windows and CentOS CI failed (#1169)
Co-authored-by: lxwcodemonkey
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
package com.tencent.supersonic.headless;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.common.pojo.Aggregator;
|
||||
import com.tencent.supersonic.common.pojo.Filter;
|
||||
@@ -15,26 +10,36 @@ import com.tencent.supersonic.common.pojo.enums.QueryType;
|
||||
import com.tencent.supersonic.common.pojo.exception.InvalidPermissionException;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.QueryStructReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.SemanticQueryResp;
|
||||
import com.tencent.supersonic.headless.core.cache.QueryCache;
|
||||
import com.tencent.supersonic.headless.core.utils.ComponentFactory;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@Slf4j
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class QueryByStructTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void testCacheQuery() throws Exception {
|
||||
@Order(0)
|
||||
public void testCacheQuery() {
|
||||
QueryStructReq queryStructReq1 = buildQueryStructReq(Arrays.asList("department"));
|
||||
QueryStructReq queryStructReq2 = buildQueryStructReq(Arrays.asList("department"));
|
||||
queryService.queryByReq(queryStructReq1, User.getFakeUser());
|
||||
SemanticQueryResp result2 = queryService.queryByReq(queryStructReq2, User.getFakeUser());
|
||||
assertTrue(result2.isUseCache());
|
||||
QueryCache queryCache = ComponentFactory.getQueryCache();
|
||||
String cacheKey1 = queryCache.getCacheKey(queryStructReq1);
|
||||
String cacheKey2 = queryCache.getCacheKey(queryStructReq2);
|
||||
Assertions.assertEquals(cacheKey1, cacheKey2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.tencent.supersonic.headless;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ItemValueReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.ItemValueResp;
|
||||
import com.tencent.supersonic.headless.server.service.TagQueryService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class QueryTagValueTest extends BaseTest {
|
||||
|
||||
@Autowired
|
||||
protected TagQueryService tagQueryService;
|
||||
|
||||
@Test
|
||||
public void testQueryTagValue() throws Exception {
|
||||
ItemValueReq itemValueReq = new ItemValueReq();
|
||||
itemValueReq.setId(1L);
|
||||
ItemValueResp itemValueResp = tagQueryService.queryTagValue(itemValueReq, User.getFakeUser());
|
||||
assertTrue(itemValueResp != null);
|
||||
}
|
||||
}
|
||||
@@ -3,26 +3,35 @@ package com.tencent.supersonic.headless;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.TagDefineType;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ItemValueReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.TagDeleteReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.TagFilterPageReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.TagReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.ItemValueResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.TagResp;
|
||||
import com.tencent.supersonic.headless.server.pojo.TagFilter;
|
||||
import com.tencent.supersonic.headless.server.service.TagMetaService;
|
||||
import com.tencent.supersonic.headless.server.service.TagQueryService;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class TagTest extends BaseTest {
|
||||
|
||||
@Autowired
|
||||
private TagMetaService tagMetaService;
|
||||
|
||||
@Autowired
|
||||
private TagQueryService tagQueryService;
|
||||
|
||||
private User user = User.getFakeUser();
|
||||
|
||||
public TagReq newTagReq() {
|
||||
@@ -46,7 +55,6 @@ public class TagTest extends BaseTest {
|
||||
return tagReq;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
TagDeleteReq tagDeleteReq = new TagDeleteReq();
|
||||
tagDeleteReq.setTagDefineType(TagDefineType.DIMENSION);
|
||||
@@ -56,6 +64,7 @@ public class TagTest extends BaseTest {
|
||||
tagMetaService.deleteBatch(tagDeleteReqList, user);
|
||||
}
|
||||
|
||||
@Order(1)
|
||||
@Test
|
||||
public void testCreateTag() {
|
||||
setUp();
|
||||
@@ -78,6 +87,7 @@ public class TagTest extends BaseTest {
|
||||
Assert.assertEquals(0, tags1.size());
|
||||
}
|
||||
|
||||
@Order(2)
|
||||
@Test
|
||||
public void testTagMarket() {
|
||||
setUp();
|
||||
@@ -100,4 +110,13 @@ public class TagTest extends BaseTest {
|
||||
tagMetaService.deleteBatch(tagDeleteReqList, user);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(0)
|
||||
public void testQueryTagValue() throws Exception {
|
||||
ItemValueReq itemValueReq = new ItemValueReq();
|
||||
itemValueReq.setId(1L);
|
||||
ItemValueResp itemValueResp = tagQueryService.queryTagValue(itemValueReq, user);
|
||||
Assertions.assertNotNull(itemValueResp);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user