Skip to content

Commit 8bd4810

Browse files
committed
AJ-605:add test case about cep
1 parent 0323998 commit 8bd4810

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

test/com/xxdb/streaming/client/cep/EventSenderTest.java

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,63 @@ public void test_EventSender_sendEvent_attributes_null() throws IOException, In
13681368
BasicTable re = (BasicTable)conn.run("select * from outputTable;");
13691369
Assert.assertEquals(1,re.rows());
13701370
}
1371+
@Test//AJ-647
1372+
public void test_EventClient_subscribe_attributes_vector_null() throws IOException, InterruptedException {
1373+
String script = "share streamTable(1000000:0, `eventType`event, [STRING,BLOB]) as inputTable;\n"+
1374+
"colNames=\"col\"+string(1..25);\n" +
1375+
"colTypes=[BOOL[],CHAR[],SHORT[],INT[],LONG[],DOUBLE[],FLOAT[],DATE[],MONTH[],TIME[],MINUTE[],SECOND[],DATETIME[],TIMESTAMP[],NANOTIME[],NANOTIMESTAMP[],DATEHOUR[],UUID[],IPADDR[],INT128[],POINT[],COMPLEX[],DECIMAL32(2)[],DECIMAL64(7)[],DECIMAL128(10)[]];\n" +
1376+
"share table(1:0,colNames,colTypes) as outputTable;\n" ;
1377+
conn.run(script);
1378+
EventScheme scheme = new EventScheme();
1379+
scheme.setEventType("event_all_array_dateType");
1380+
scheme.setAttrKeys(Arrays.asList("boolv", "charv", "shortv", "intv", "longv", "doublev", "floatv", "datev", "monthv", "timev", "minutev", "secondv", "datetimev", "timestampv", "nanotimev", "nanotimestampv", "datehourv", "uuidv", "ippaddrv", "int128v", "pointv", "complexv", "decimal32v", "decimal64v", "decimal128v"));
1381+
scheme.setAttrTypes(Arrays.asList(DT_BOOL, DT_BYTE, DT_SHORT, DT_INT, DT_LONG, DT_DOUBLE, DT_FLOAT, DT_DATE,DT_MONTH, DT_TIME, DT_MINUTE, DT_SECOND, DT_DATETIME, DT_TIMESTAMP, DT_NANOTIME, DT_NANOTIMESTAMP, DT_DATEHOUR, DT_UUID, DT_IPADDR, DT_INT128, DT_POINT, DT_COMPLEX, DT_DECIMAL32, DT_DECIMAL64, DT_DECIMAL128));
1382+
//scheme.setAttrTypes(Arrays.asList(DT_BOOL_ARRAY, DT_BYTE_ARRAY, DT_SHORT_ARRAY, DT_INT_ARRAY, DT_LONG_ARRAY, DT_DOUBLE_ARRAY, DT_FLOAT_ARRAY, DT_DATE_ARRAY,DT_MONTH_ARRAY, DT_TIME_ARRAY, DT_MINUTE_ARRAY, DT_SECOND_ARRAY, DT_DATETIME_ARRAY, DT_TIMESTAMP_ARRAY, DT_NANOTIME_ARRAY, DT_NANOTIMESTAMP_ARRAY, DT_DATEHOUR_ARRAY, DT_UUID_ARRAY, DT_IPADDR_ARRAY, DT_INT128_ARRAY, DT_POINT_ARRAY, DT_COMPLEX_ARRAY, DT_DECIMAL32_ARRAY, DT_DECIMAL64_ARRAY, DT_DECIMAL128_ARRAY));
1383+
scheme.setAttrForms(Arrays.asList( DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR, DF_VECTOR));
1384+
1385+
List<EventScheme> eventSchemes = Collections.singletonList(scheme);
1386+
List<String> eventTimeKeys = new ArrayList<>();
1387+
List<String> commonKeys = new ArrayList<>();
1388+
EventSender sender = EventSender.createEventSender(eventSchemes, eventTimeKeys, commonKeys);
1389+
sender.connect(conn,"inputTable");
13711390

1391+
EventClient client = new EventClient(eventSchemes, eventTimeKeys, commonKeys);
1392+
client.subscribe(HOST, PORT, "inputTable", "test1", handler, -1, true, "admin", "123456");
1393+
1394+
List<Entity> attributes = new ArrayList<>();
1395+
attributes.add(new BasicBooleanVector(0));
1396+
attributes.add(new BasicByteVector(0));
1397+
attributes.add(new BasicShortVector(0));
1398+
attributes.add(new BasicIntVector(0));
1399+
attributes.add(new BasicLongVector(0));
1400+
attributes.add(new BasicDoubleVector(0));
1401+
attributes.add(new BasicFloatVector(0));
1402+
attributes.add(new BasicDateVector(0));
1403+
attributes.add(new BasicMonthVector(0));
1404+
attributes.add(new BasicTimeVector(0));
1405+
attributes.add(new BasicMinuteVector(0));
1406+
attributes.add(new BasicSecondVector(0));
1407+
attributes.add(new BasicDateTimeVector(0));
1408+
attributes.add(new BasicTimestampVector(0));
1409+
attributes.add(new BasicNanoTimeVector(0));
1410+
attributes.add(new BasicNanoTimestampVector(0));
1411+
attributes.add(new BasicDateHourVector(0));
1412+
attributes.add(new BasicUuidVector(0));
1413+
attributes.add(new BasicIPAddrVector(0));
1414+
attributes.add(new BasicInt128Vector(0));
1415+
attributes.add(new BasicPointVector(0));
1416+
attributes.add(new BasicComplexVector(0));
1417+
attributes.add(new BasicDecimal32Vector(0,0));
1418+
attributes.add(new BasicDecimal64Vector(0,0));
1419+
attributes.add(new BasicDecimal128Vector(0,0));
1420+
sender.sendEvent("event_all_array_dateType", attributes);
1421+
//conn.run("tableInsert{outputTable}", attributes);
1422+
Thread.sleep(2000);
1423+
BasicTable re = (BasicTable)conn.run("select * from inputTable;");
1424+
Assert.assertEquals(1,re.rows());
1425+
BasicTable re1 = (BasicTable)conn.run("select * from outputTable;");
1426+
Assert.assertEquals(1,re1.rows());
1427+
}
13721428
@Test//AJ-647
13731429
public void test_EventClient_subscribe_attributes_array_null() throws IOException, InterruptedException {
13741430
String script = "share streamTable(1000000:0, `eventType`event, [STRING,BLOB]) as inputTable;\n"+
@@ -1851,9 +1907,10 @@ public void test_EventSender_all_dateType_scalar_DECIMAL() throws IOException,
18511907
Thread.sleep(2000);
18521908
BasicTable bt2 = (BasicTable) conn.run("select * from intput;");
18531909
Assert.assertEquals(1, bt2.rows());
1910+
checkData(bt1,bt2);
18541911
BasicTable bt3 = (BasicTable) conn.run("select * from outputTable;");
18551912
Assert.assertEquals(1, bt3.rows());
1856-
checkData(bt1,bt2);
1913+
System.out.println(bt3.getString());
18571914
}
18581915
}
18591916
@Test

0 commit comments

Comments
 (0)