当前位置: 首页>>代码示例>>Java>>正文


Java RepositoryException.printStackTrace方法代码示例

本文整理汇总了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()); }
	 */
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:36,代码来源:MarkLogicRepositoryConnectionTest.java

示例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());
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:51,代码来源:TestCloseWait.java

示例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());
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:44,代码来源:MarkLogicRepositoryConnectionTest.java

示例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());

}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:45,代码来源:MarkLogicRepositoryConnectionTest.java


注:本文中的org.eclipse.rdf4j.repository.RepositoryException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。