本文整理汇总了Java中org.eclipse.rdf4j.repository.RepositoryException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryException.printStackTrace方法的具体用法?Java RepositoryException.printStackTrace怎么用?Java RepositoryException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.rdf4j.repository.RepositoryException
的用法示例。
在下文中一共展示了RepositoryException.printStackTrace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetStatementsLanguageLiteral
import org.eclipse.rdf4j.repository.RepositoryException; //导入方法依赖的package包/类
@Test
public void testGetStatementsLanguageLiteral() throws Exception {
Literal validLanguageLiteral = vf.createLiteral("the number four", "en");
try {
testAdminCon.add(micah, homeTel, validLanguageLiteral, dirgraph);
RepositoryResult<Statement> statements = testAdminCon.getStatements(null, null, null, true, dirgraph);
assertNotNull(statements);
assertTrue(statements.hasNext());
Statement st = statements.next();
assertTrue(st.getObject() instanceof Literal);
assertTrue(st.getObject().equals(validLanguageLiteral));
} catch (RepositoryException e) {
// shouldn't happen
e.printStackTrace();
fail(e.getMessage());
}
// Uncomment after 178 is fixed.
/*
* testAdminCon.clear(); Literal invalidLanguageLiteral =
* vf.createLiteral("the number four", "en_us"); try {
* testAdminCon.add(micah, homeTel, invalidLanguageLiteral,dirgraph);
*
* RepositoryResult<Statement> statements =
* testAdminCon.getStatements(null, null, null, true,dirgraph);
*
* assertNotNull(statements); assertTrue(statements.hasNext());
* Statement st = statements.next(); assertTrue(st.getObject()
* instanceof Literal);
* assertTrue(st.getObject().equals(invalidLanguageLiteral)); } catch
* (RepositoryException e) { // shouldn't happen fail(e.getMessage()); }
*/
}
示例2: testMultiThreadedAdd2
import org.eclipse.rdf4j.repository.RepositoryException; //导入方法依赖的package包/类
@Test
public void testMultiThreadedAdd2() throws Exception{
Assert.assertEquals(0, conn.size());
class MyRunnable implements Runnable {
@Override
public void run(){
try {
for (int j =0 ;j < 100; j++){
IRI subject = vf.createIRI(NS+ID+"/"+Thread.currentThread().getId()+"/"+j+"#1111");
IRI predicate = vf.createIRI(NS+ADDRESS+"/"+Thread.currentThread().getId()+"/"+"#firstName");
Literal object = vf.createLiteral(Thread.currentThread().getId()+ "-" + j +"-" +"John");
conn.add(subject, predicate,object, dirgraph);
}
} catch (RepositoryException e1) {
e1.printStackTrace();
}finally {
try {
conn.sync();
} catch (MarkLogicRdf4jException e) {
e.printStackTrace();
}
}
}
}
Thread t1,t2,t3,t4;
t1 = new Thread(new MyRunnable());
t1.setName("T1");
t2 = new Thread(new MyRunnable());
t2.setName("T2");
t3 = new Thread(new MyRunnable());
t3.setName("T3");
t4 = new Thread(new MyRunnable());
t4.setName("T4");
t1.start();
t2.start();
t3.start();
t4.start();
t1.join();
t2.join();
t3.join();
t4.join();
Assert.assertEquals(400, conn.size());
}
示例3: testMultiThreadedAdd2
import org.eclipse.rdf4j.repository.RepositoryException; //导入方法依赖的package包/类
@Test
public void testMultiThreadedAdd2() throws Exception {
Assert.assertEquals(0, testAdminCon.size());
class MyRunnable implements Runnable {
@Override
public void run() {
try {
for (int j = 0; j < 100; j++) {
IRI subject = vf.createIRI(NS + ID + "/" + Thread.currentThread().getId() + "/" + j + "#1111");
IRI predicate = vf
.createIRI(NS + ADDRESS + "/" + Thread.currentThread().getId() + "/" + "#firstName");
Literal object = vf.createLiteral(Thread.currentThread().getId() + "-" + j + "-" + "John");
testAdminCon.add(subject, predicate, object, dirgraph);
}
} catch (RepositoryException e1) {
e1.printStackTrace();
}
}
}
Thread t1, t2, t3, t4;
t1 = new Thread(new MyRunnable());
t1.setName("T1");
t2 = new Thread(new MyRunnable());
t2.setName("T2");
t3 = new Thread(new MyRunnable());
t3.setName("T3");
t4 = new Thread(new MyRunnable());
t4.setName("T4");
t1.start();
t2.start();
t3.start();
t4.start();
t1.join();
t2.join();
t3.join();
t4.join();
Assert.assertEquals(400, testAdminCon.size());
}
示例4: testMultiThreadedAddDuplicate
import org.eclipse.rdf4j.repository.RepositoryException; //导入方法依赖的package包/类
@Test
public void testMultiThreadedAddDuplicate() throws Exception {
class MyRunnable implements Runnable {
@Override
public void run() {
for (int j = 0; j < 100; j++) {
IRI subject = vf.createIRI(NS + ID + "/" + j + "#1111");
IRI predicate = fname = vf.createIRI(NS + ADDRESS + "/" + "#firstName");
Literal object = vf.createLiteral(j + "-" + "John");
try {
testAdminCon.add(subject, predicate, object, dirgraph);
} catch (RepositoryException e) {
e.printStackTrace();
}
}
}
}
Thread t1, t2, t3, t4, t5;
t1 = new Thread(new MyRunnable());
t2 = new Thread(new MyRunnable());
t3 = new Thread(new MyRunnable());
t4 = new Thread(new MyRunnable());
t5 = new Thread(new MyRunnable());
t1.start();
t2.start();
t3.start();
t4.start();
t5.start();
t1.join();
t2.join();
t3.join();
t4.join();
t5.join();
Assert.assertEquals(100, testAdminCon.size());
}