本文整理汇总了Java中org.jooq.impl.DefaultDSLContext类的典型用法代码示例。如果您正苦于以下问题:Java DefaultDSLContext类的具体用法?Java DefaultDSLContext怎么用?Java DefaultDSLContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultDSLContext类属于org.jooq.impl包,在下文中一共展示了DefaultDSLContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: should_not_contain_where_clause_on_submissions
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test
public void should_not_contain_where_clause_on_submissions() throws Exception {
// given
SubmissionListFilter filter = new SubmissionListFilter();
filter.getStatuses().setStatuses(new ArrayList<>());
final DSLContext create = new DefaultDSLContext(SQLDialect.POSTGRES);
final SelectJoinStep step = create.select().from();
// when
SubmissionFilterAppender.appendOn(filter, step);
// then
assertThat("should not contain where clause on submissions",
step.getSQL(),
not(containsString("where 1 = 0")));
}
示例2: doInTransactionWithException
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T extends Throwable> void doInTransactionWithException(ExceptionRunnable<T> run) throws T {
Throwable[] t = new Throwable[1];
try(DSLContext c = new DefaultDSLContext(configuration)) {
c.transaction(() -> {
try {
run.run();
} catch (Throwable e) {
ExceptionUtils.rethrowRuntime(e);
t[0] = e;
}
});
}
if (t[0] != null) {
throw (T)t[0];
}
}
示例3: test02
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test02() throws Throwable {
SQLDialect sQLDialect0 = SQLDialect.POSTGRES_9_4;
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0);
Product product0 = new Product();
// Undeclared exception!
try {
WorkspaceSnapshot.selectWorkspaceClosure(defaultDSLContext0,
product0);
fail("Expecting exception: RuntimeException");
} catch (RuntimeException e) {
//
// Cannot execute query. No Connection configured
//
assertThrownBy("org.jooq.impl.AbstractQuery", e);
}
}
示例4: test05
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test05() throws Throwable {
WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot();
Product product0 = new Product();
workspaceSnapshot0.definingProduct = product0;
DefaultConfiguration defaultConfiguration0 = new DefaultConfiguration();
NoConnectionProvider noConnectionProvider0 = (NoConnectionProvider) defaultConfiguration0.connectionProvider();
SQLDialect sQLDialect0 = SQLDialect.SQLITE;
Settings settings0 = new Settings();
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(noConnectionProvider0,
sQLDialect0,
settings0);
// Undeclared exception!
try {
workspaceSnapshot0.loadDefiningProduct(defaultDSLContext0);
fail("Expecting exception: RuntimeException");
} catch (RuntimeException e) {
//
// Cannot execute query. No Connection configured
//
assertThrownBy("org.jooq.impl.AbstractQuery", e);
}
}
示例5: test09
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test09() throws Throwable {
WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot();
Product product0 = new Product();
workspaceSnapshot0.definingProduct = product0;
SQLDialect sQLDialect0 = SQLDialect.MARIADB;
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0);
// Undeclared exception!
try {
workspaceSnapshot0.load(defaultDSLContext0);
fail("Expecting exception: RuntimeException");
} catch (RuntimeException e) {
//
// Cannot execute query. No Connection configured
//
assertThrownBy("org.jooq.impl.AbstractQuery", e);
}
}
示例6: test10
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test10() throws Throwable {
WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot();
Product product0 = new Product();
workspaceSnapshot0.definingProduct = product0;
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext((SQLDialect) null);
// Undeclared exception!
try {
workspaceSnapshot0.load(defaultDSLContext0);
fail("Expecting exception: NullPointerException");
} catch (NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
assertThrownBy("org.jooq.impl.AbstractScope", e);
}
}
示例7: test11
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test11() throws Throwable {
UUID uUID0 = UUID.randomUUID();
SQLDialect sQLDialect0 = SQLDialect.MYSQL;
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0);
// Undeclared exception!
try {
WorkspaceSnapshot.getAuthorizations(uUID0, defaultDSLContext0);
fail("Expecting exception: RuntimeException");
} catch (RuntimeException e) {
//
// Cannot execute query. No Connection configured
//
assertThrownBy("org.jooq.impl.AbstractQuery", e);
}
}
示例8: test13
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test13() throws Throwable {
UUID uUID0 = new UUID(948L, 0L);
SQLDialect sQLDialect0 = SQLDialect.CUBRID;
Settings settings0 = new Settings();
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext((DataSource) null,
sQLDialect0,
settings0);
// Undeclared exception!
try {
WorkspaceSnapshot.getAuthorizations(uUID0, defaultDSLContext0);
fail("Expecting exception: NullPointerException");
} catch (NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
assertThrownBy("org.jooq.impl.DataSourceConnectionProvider", e);
}
}
示例9: test14
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test14() throws Throwable {
WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot();
DefaultConfiguration defaultConfiguration0 = new DefaultConfiguration();
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(defaultConfiguration0);
// Undeclared exception!
try {
workspaceSnapshot0.deltaFrom(defaultDSLContext0,
workspaceSnapshot0);
fail("Expecting exception: NullPointerException");
} catch (NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
assertThrownBy("com.chiralbehaviors.CoRE.workspace.WorkspaceSnapshot",
e);
}
}
示例10: test15
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test15() throws Throwable {
SQLDialect sQLDialect0 = SQLDialect.H2;
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0);
Product product0 = new Product();
try {
new WorkspaceSnapshot(product0, defaultDSLContext0);
fail("Expecting exception: RuntimeException");
} catch (RuntimeException e) {
//
// Cannot execute query. No Connection configured
//
assertThrownBy("org.jooq.impl.AbstractQuery", e);
}
}
示例11: test18
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test18() throws Throwable {
Product product0 = new Product();
PGPoolingDataSource pGPoolingDataSource0 = PGPoolingDataSource.getDataSource("");
SQLDialect sQLDialect0 = SQLDialect.MARIADB;
Settings settings0 = new Settings();
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(pGPoolingDataSource0,
sQLDialect0,
settings0);
try {
new WorkspaceSnapshot(product0, defaultDSLContext0);
fail("Expecting exception: NullPointerException");
} catch (NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
assertThrownBy("org.jooq.impl.DataSourceConnectionProvider", e);
}
}
示例12: test22
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test22() throws Throwable {
WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot();
Jdbc3SimpleDataSource jdbc3SimpleDataSource0 = new Jdbc3SimpleDataSource();
DataSourceConnectionProvider dataSourceConnectionProvider0 = new DataSourceConnectionProvider(jdbc3SimpleDataSource0);
SQLDialect sQLDialect0 = SQLDialect.FIREBIRD;
Settings settings0 = new Settings();
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(dataSourceConnectionProvider0,
sQLDialect0,
settings0);
// Undeclared exception!
try {
workspaceSnapshot0.load(defaultDSLContext0);
fail("Expecting exception: NullPointerException");
} catch (NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
assertThrownBy("com.chiralbehaviors.CoRE.workspace.WorkspaceSnapshot",
e);
}
}
示例13: test23
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Test(timeout = 4000)
public void test23() throws Throwable {
SQLDialect sQLDialect0 = SQLDialect.SQLITE;
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext((DataSource) null,
sQLDialect0,
(Settings) null);
Product product0 = new Product();
// Undeclared exception!
try {
WorkspaceSnapshot.selectWorkspaceClosure(defaultDSLContext0,
product0);
fail("Expecting exception: NullPointerException");
} catch (NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
assertThrownBy("org.jooq.impl.DataSourceConnectionProvider", e);
}
}
示例14: doInTransaction
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Override
public void doInTransaction(Runnable run) {
try(DSLContext c = new DefaultDSLContext(configuration)) {
c.transaction(() -> {
run.run();
});
}
}
示例15: doInTransactionResult
import org.jooq.impl.DefaultDSLContext; //导入依赖的package包/类
@Override
public <T> T doInTransactionResult(Supplier<T> run) {
try(DSLContext c = new DefaultDSLContext(configuration)) {
return c.transactionResult(() -> {
return run.get();
});
}
}