本文整理汇总了Java中com.taobao.tddl.executor.repo.RepositoryHolder.getOrCreateRepository方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryHolder.getOrCreateRepository方法的具体用法?Java RepositoryHolder.getOrCreateRepository怎么用?Java RepositoryHolder.getOrCreateRepository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.executor.repo.RepositoryHolder
的用法示例。
在下文中一共展示了RepositoryHolder.getOrCreateRepository方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetReturnColumnsBeforeNext
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testGetReturnColumnsBeforeNext() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
Assert.assertEquals("[T1.ID, T1.NAME, T1.SCHOOL]", c.getReturnColumns().toString());
Assert.assertEquals("[OrderBy [columnName=T1.ID, direction=true]]", c.getOrderBy().toString());
}
示例2: testWithOutColumns
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testWithOutColumns() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
TempTableCursor c = new TempTableCursor(bdbRepo, subCursor, true, 1, ec);
Object[] expected = new Object[] { 1, 1, 2, 3, 4, 5, 5 };
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
Assert.assertTrue(mockCursor.isClosed());
}
示例3: testWithColumns
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testWithColumns() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
ColumnMeta cm = new ColumnMeta("T1", "NAME", DataType.IntegerType, null, true);
TempTableCursor c = new TempTableCursor(bdbRepo, subCursor, true, Arrays.asList(cm), 2, ec);
Object[] expected = new Object[] { "name1", "name2", "name3", "name4", "name5", "name5" };
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
Assert.assertTrue(mockCursor.isClosed());
}
示例4: testGetReturnColumnsBeforeNext
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testGetReturnColumnsBeforeNext() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
Assert.assertEquals("[T1.ID, T1.NAME, T1.SCHOOL]", c.getReturnColumns().toString());
Assert.assertEquals("[OrderBy [columnName=T1.ID, direction=true]]", c.getOrderBy().toString());
}
示例5: testSort
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testSort() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
Object[] expected = new Object[] { 1, 2, 3, 4, 5, 5 };
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
Assert.assertTrue(mockCursor.isClosed());
}
示例6: testNull
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testNull() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
SchematicCursor subCursor = new SchematicCursor(this.getCursor("T1",
new Integer[] { 5, null, 4, 3, 2, null, 1 }));
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
Object[] expected = new Object[] { 1, 2, 3, 4, 5, null, null };
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
}
示例7: testEmpty
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testEmpty() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
SchematicCursor subCursor = new SchematicCursor(this.getCursor("T1", new Integer[] {}));
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
Object[] expected = new Object[] {};
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
}
示例8: testGetReturnColumnsAfterNext
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testGetReturnColumnsAfterNext() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
while (c.next() != null)
;
Assert.assertEquals("[T1.ID, T1.NAME, T1.SCHOOL]", c.getReturnColumns().toString());
Assert.assertEquals("[OrderBy [columnName=T1.ID, direction=true]]", c.getOrderBy().toString());
}
示例9: testWithOutColumnsBeforeFirst
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testWithOutColumnsBeforeFirst() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP, Collections.EMPTY_MAP);
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
TempTableCursor c = new TempTableCursor(bdbRepo, subCursor, true, 3, ec);
Object[] expected = new Object[] { 1, 2, 3, 4, 5, 5, 1, 2, 3, 4, 5, 5 };
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
c.beforeFirst();
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
Assert.assertTrue(mockCursor.isClosed());
}
示例10: testSort
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testSort() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
Object[] expected = new Object[] { 1, 2, 3, 4, 5, 5 };
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
Assert.assertTrue(mockCursor.isClosed());
}
示例11: testNull
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testNull() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
SchematicCursor subCursor = new SchematicCursor(this.getCursor("T1",
new Integer[] { 5, null, 4, 3, 2, null, 1 }));
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
Object[] expected = new Object[] { 1, 2, 3, 4, 5, null, null };
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
}
示例12: testEmpty
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testEmpty() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
SchematicCursor subCursor = new SchematicCursor(this.getCursor("T1", new Integer[] {}));
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
Object[] expected = new Object[] {};
List actual = new ArrayList();
IRowSet row = null;
while ((row = c.next()) != null) {
System.out.println(row);
actual.add(row.getObject(0));
}
Assert.assertArrayEquals(expected, actual.toArray());
}
示例13: testGetReturnColumnsAfterNext
import com.taobao.tddl.executor.repo.RepositoryHolder; //导入方法依赖的package包/类
@Test
public void testGetReturnColumnsAfterNext() throws TddlException {
RepositoryHolder repoHolder = new RepositoryHolder();
StaticSchemaManager sm = new StaticSchemaManager("test_schema.xml", null, null);
sm.init();
IRepository bdbRepo = repoHolder.getOrCreateRepository("BDB_JE", Collections.EMPTY_MAP);
ICursorFactory cf = new CursorFactoryDefaultImpl();
MockArrayCursor mockCursor = this.getCursor("T1", new Integer[] { 5, 5, 4, 3, 2, 1 });
SchematicCursor subCursor = new SchematicCursor(mockCursor);
IOrderBy order = new OrderBy();
order.setColumn(new Column().setColumnName("ID").setTableName("T1").setDataType(DataType.IntegerType));
List<IOrderBy> orderBys = new ArrayList();
orderBys.add(order);
TempTableSortCursor c = new TempTableSortCursor(cf,
bdbRepo,
subCursor,
orderBys,
true,
0,
new ExecutionContext());
while (c.next() != null)
;
Assert.assertEquals("[T1.ID, T1.NAME, T1.SCHOOL]", c.getReturnColumns().toString());
Assert.assertEquals("[OrderBy [columnName=T1.ID, direction=true]]", c.getOrderBy().toString());
}