change
This commit is contained in:
parent
16b35ba58c
commit
efa1709fdf
|
@ -0,0 +1,23 @@
|
|||
package com.taosdata.taosdemo.service;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class DatabaseServiceTest {
|
||||
private DatabaseService service;
|
||||
|
||||
@Test
|
||||
public void testCreateDatabase1() {
|
||||
service.createDatabase("testXXXX");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dropDatabase() {
|
||||
service.dropDatabase("testXXXX");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void useDatabase() {
|
||||
service.useDatabase("test");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.taosdata.taosdemo.service;
|
||||
|
||||
import com.taosdata.taosdemo.domain.SubTableMeta;
|
||||
import com.taosdata.taosdemo.domain.TagValue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SubTableServiceTest {
|
||||
private SubTableService service;
|
||||
|
||||
private List<SubTableMeta> subTables;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
subTables = new ArrayList<>();
|
||||
for (int i = 1; i <= 1; i++) {
|
||||
SubTableMeta subTableMeta = new SubTableMeta();
|
||||
subTableMeta.setDatabase("test");
|
||||
subTableMeta.setSupertable("weather");
|
||||
subTableMeta.setName("t" + i);
|
||||
List<TagValue> tags = new ArrayList<>();
|
||||
tags.add(new TagValue("location", "beijing"));
|
||||
tags.add(new TagValue("groupId", i));
|
||||
subTableMeta.setTags(tags);
|
||||
subTables.add(subTableMeta);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateSubTable() {
|
||||
int count = service.createSubTable(subTables);
|
||||
System.out.println("count >>> " + count);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateSubTableList() {
|
||||
int count = service.createSubTable(subTables, 10);
|
||||
System.out.println("count >>> " + count);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.taosdata.taosdemo.service;
|
||||
|
||||
import com.taosdata.taosdemo.domain.FieldMeta;
|
||||
import com.taosdata.taosdemo.domain.SuperTableMeta;
|
||||
import com.taosdata.taosdemo.domain.TagMeta;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SuperTableServiceTest {
|
||||
|
||||
private SuperTableService service;
|
||||
|
||||
@Test
|
||||
public void testCreate() {
|
||||
SuperTableMeta superTableMeta = new SuperTableMeta();
|
||||
superTableMeta.setDatabase("test");
|
||||
superTableMeta.setName("weather");
|
||||
List<FieldMeta> fields = new ArrayList<>();
|
||||
fields.add(new FieldMeta("ts", "timestamp"));
|
||||
fields.add(new FieldMeta("temperature", "float"));
|
||||
fields.add(new FieldMeta("humidity", "int"));
|
||||
superTableMeta.setFields(fields);
|
||||
List<TagMeta> tags = new ArrayList<>();
|
||||
tags.add(new TagMeta("location", "nchar(64)"));
|
||||
tags.add(new TagMeta("groupId", "int"));
|
||||
superTableMeta.setTags(tags);
|
||||
service.create(superTableMeta);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.taosdata.taosdemo.service;
|
||||
|
||||
import com.taosdata.taosdemo.domain.TableMeta;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TableServiceTest {
|
||||
private TableService tableService;
|
||||
|
||||
private List<TableMeta> tables;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
tables = new ArrayList<>();
|
||||
for (int i = 0; i < 1; i++) {
|
||||
TableMeta tableMeta = new TableMeta();
|
||||
tableMeta.setDatabase("test");
|
||||
tableMeta.setName("weather" + (i + 1));
|
||||
tables.add(tableMeta);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreate() {
|
||||
tableService.create(tables);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue