mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 06:27:21 +00:00
[improvement][project] supersonic 0.6.0 version update (#16)
Co-authored-by: lexluo <lexluo@tencent.com>
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
package com.tencent.supersonic.chat.domain.utils;
|
||||
|
||||
import com.tencent.supersonic.semantic.api.core.enums.TimeDimensionEnum;
|
||||
import java.text.MessageFormat;
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author lex luo
|
||||
* @date 2023/6/29 16:05
|
||||
*/
|
||||
class DslToSemanticInfoTest {
|
||||
|
||||
@Test
|
||||
void search() {
|
||||
|
||||
Integer domainId = 1;
|
||||
String dayField = TimeDimensionEnum.DAY.getName();
|
||||
String startDate = "2023-04-01";
|
||||
String endDate = "2023-06-01";
|
||||
|
||||
String format = MessageFormat.format(DslToSemanticInfo.SUB_TABLE, domainId, dayField, startDate, endDate);
|
||||
|
||||
Assert.assertEquals(format,
|
||||
" ( select * from t_1 where sys_imp_date >= '2023-04-01' and sys_imp_date <= '2023-06-01' ) as t_sub_1");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,8 @@ import com.tencent.supersonic.semantic.api.core.response.DomainSchemaResp;
|
||||
import com.tencent.supersonic.semantic.api.core.response.MetricResp;
|
||||
import com.tencent.supersonic.semantic.api.core.response.MetricSchemaResp;
|
||||
import com.tencent.supersonic.chat.application.ConfigServiceImpl;
|
||||
import com.tencent.supersonic.chat.domain.pojo.config.ChatConfigInfo;
|
||||
import com.tencent.supersonic.chat.domain.pojo.config.ChatConfigRichInfo;
|
||||
import com.tencent.supersonic.chat.domain.pojo.config.ChatConfigResp;
|
||||
import com.tencent.supersonic.chat.domain.pojo.config.ChatConfigRichResp;
|
||||
import com.tencent.supersonic.chat.domain.pojo.config.DefaultMetric;
|
||||
import com.tencent.supersonic.chat.domain.pojo.config.DefaultMetricInfo;
|
||||
import com.tencent.supersonic.chat.domain.pojo.config.EntityInternalDetail;
|
||||
@@ -47,17 +47,17 @@ public class MockBeansConfiguration {
|
||||
|
||||
public static void buildHttpSemanticServiceImpl(SemanticLayer httpSemanticLayer, List<DimSchemaResp> dimensionDescs,
|
||||
List<MetricSchemaResp> metricDescs) {
|
||||
ChatConfigRichInfo chaConfigRichDesc = new ChatConfigRichInfo();
|
||||
ChatConfigRichResp chaConfigRichDesc = new ChatConfigRichResp();
|
||||
DefaultMetric defaultMetricDesc = new DefaultMetric();
|
||||
defaultMetricDesc.setUnit(3);
|
||||
defaultMetricDesc.setPeriod(Constants.DAY);
|
||||
chaConfigRichDesc.setDefaultMetrics(new ArrayList<>(Arrays.asList(defaultMetricDesc)));
|
||||
// chaConfigRichDesc.setDefaultMetrics(new ArrayList<>(Arrays.asList(defaultMetricDesc)));
|
||||
EntityRichInfo entityDesc = new EntityRichInfo();
|
||||
List<DimSchemaResp> dimensionDescs1 = new ArrayList<>();
|
||||
DimSchemaResp dimensionDesc = new DimSchemaResp();
|
||||
dimensionDesc.setId(162L);
|
||||
dimensionDescs1.add(dimensionDesc);
|
||||
entityDesc.setEntityIds(dimensionDescs1);
|
||||
// entityDesc.setEntityIds(dimensionDescs1);
|
||||
|
||||
DimSchemaResp dimensionDesc2 = new DimSchemaResp();
|
||||
dimensionDesc2.setId(163L);
|
||||
@@ -71,14 +71,14 @@ public class MockBeansConfiguration {
|
||||
metricDesc.setBizName("js_play_cnt");
|
||||
metricDesc.setName("结算播放量");
|
||||
entityInternalDetailDesc.setMetricList(new ArrayList<>(Arrays.asList(metricDesc)));
|
||||
entityDesc.setEntityInternalDetailDesc(entityInternalDetailDesc);
|
||||
// entityDesc.setEntityInternalDetailDesc(entityInternalDetailDesc);
|
||||
|
||||
chaConfigRichDesc.setEntity(entityDesc);
|
||||
// chaConfigRichDesc.setEntity(entityDesc);
|
||||
// when(httpSemanticLayer.getChatConfigRichInfo(anyLong())).thenReturn(chaConfigRichDesc);
|
||||
DomainSchemaResp domainSchemaDesc = new DomainSchemaResp();
|
||||
domainSchemaDesc.setDimensions(dimensionDescs);
|
||||
domainSchemaDesc.setMetrics(metricDescs);
|
||||
when(httpSemanticLayer.getDomainSchemaInfo(anyLong())).thenReturn(domainSchemaDesc);
|
||||
// when(httpSemanticLayer.getDomainSchemaInfo(anyLong())).thenReturn(domainSchemaDesc);
|
||||
|
||||
DomainInfos domainInfos = new DomainInfos();
|
||||
when(SchemaInfoConverter.convert(httpSemanticLayer.getDomainSchemaInfo(anyList()))).thenReturn(domainInfos);
|
||||
@@ -92,8 +92,8 @@ public class MockBeansConfiguration {
|
||||
List<DefaultMetricInfo> defaultMetricInfos = new ArrayList<>();
|
||||
defaultMetricInfos.add(defaultMetricInfo);
|
||||
|
||||
ChatConfigInfo chaConfigDesc = new ChatConfigInfo();
|
||||
chaConfigDesc.setDefaultMetrics(defaultMetricInfos);
|
||||
ChatConfigResp chaConfigDesc = new ChatConfigResp();
|
||||
// chaConfigDesc.setDefaultMetrics(defaultMetricInfos);
|
||||
when(configService.fetchConfigByDomainId(anyLong())).thenReturn(chaConfigDesc);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user