當前位置: 首頁>>代碼示例>>Java>>正文


Java OperationException類代碼示例

本文整理匯總了Java中net.spy.memcached.ops.OperationException的典型用法代碼示例。如果您正苦於以下問題:Java OperationException類的具體用法?Java OperationException怎麽用?Java OperationException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OperationException類屬於net.spy.memcached.ops包,在下文中一共展示了OperationException類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testTimeoutException

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
@Test
public void testTimeoutException() {
    Long timeout = 1000L;
    TimeUnit unit = TimeUnit.MILLISECONDS;

    MockOperationFuture future = mock(MockOperationFuture.class);
    MockOperation operation = mock(MockOperation.class);

    try {
        OperationException exception = new OperationException(OperationErrorType.GENERAL, "timed out");
        when(operation.getException()).thenReturn(exception);
        when(operation.isCancelled()).thenReturn(true);
        when(future.__getTraceObject1()).thenReturn(operation);

        MemcachedNode node = getMockMemcachedNode();
        when(operation.getHandlingNode()).thenReturn(node);

        interceptor.before(future, new Object[] { timeout, unit });
        interceptor.after(future, new Object[] { timeout, unit }, null, null);
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
 
開發者ID:masonmei,項目名稱:apm-agent,代碼行數:24,代碼來源:FutureGetInterceptorTest.java

示例2: testStupidlyLargeSetAndSizeOverride

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
public void testStupidlyLargeSetAndSizeOverride() throws Exception {
	Random r=new Random();
	SerializingTranscoder st=new SerializingTranscoder(Integer.MAX_VALUE);

	st.setCompressionThreshold(Integer.MAX_VALUE);

	byte data[]=new byte[10*1024*1024];
	r.nextBytes(data);

	try {
		client.set("bigassthing", 60, data, st).get();
		fail("Didn't fail setting bigass thing.");
	} catch(ExecutionException e) {
		e.printStackTrace();
		OperationException oe=(OperationException)e.getCause();
		assertSame(OperationErrorType.SERVER, oe.getType());
	}

	// But I should still be able to do something.
	client.set("k", 5, "Blah");
	assertEquals("Blah", client.get("k"));
}
 
開發者ID:naver,項目名稱:arcus-java-client,代碼行數:23,代碼來源:ProtocolBaseCase.java

示例3: testServer

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
public void testServer() {
	OperationException oe=new OperationException(
		OperationErrorType.SERVER, "SERVER_ERROR figures");
	assertSame(OperationErrorType.SERVER, oe.getType());
	assertEquals("OperationException: SERVER: SERVER_ERROR figures",
		String.valueOf(oe));
}
 
開發者ID:naver,項目名稱:arcus-java-client,代碼行數:8,代碼來源:OperationExceptionTest.java

示例4: testClient

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
public void testClient() {
	OperationException oe=new OperationException(
		OperationErrorType.CLIENT, "CLIENT_ERROR nope");
	assertSame(OperationErrorType.CLIENT, oe.getType());
	assertEquals("OperationException: CLIENT: CLIENT_ERROR nope",
		String.valueOf(oe));
}
 
開發者ID:naver,項目名稱:arcus-java-client,代碼行數:8,代碼來源:OperationExceptionTest.java

示例5: testGeneral

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
public void testGeneral() {
	// General type doesn't have additional info
	OperationException oe=new OperationException(
		OperationErrorType.GENERAL, "GENERAL wtf");
	assertSame(OperationErrorType.GENERAL, oe.getType());
	assertEquals("OperationException: GENERAL", String.valueOf(oe));
}
 
開發者ID:naver,項目名稱:arcus-java-client,代碼行數:8,代碼來源:OperationExceptionTest.java

示例6: getException

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
public final OperationException getException() {
  return exception;
}
 
開發者ID:Alachisoft,項目名稱:TayzGrid,代碼行數:4,代碼來源:BaseOperationImpl.java

示例7: getException

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
public OperationException getException() {
    return null;
}
 
開發者ID:masonmei,項目名稱:apm-agent,代碼行數:4,代碼來源:FutureGetInterceptorTest.java

示例8: getException

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
public final OperationException getException() {
	return exception;
}
 
開發者ID:naver,項目名稱:arcus-java-client,代碼行數:4,代碼來源:BaseOperationImpl.java

示例9: testEmpty

import net.spy.memcached.ops.OperationException; //導入依賴的package包/類
public void testEmpty() {
	OperationException oe=new OperationException();
	assertSame(OperationErrorType.GENERAL, oe.getType());
	assertEquals("OperationException: GENERAL", String.valueOf(oe));
}
 
開發者ID:naver,項目名稱:arcus-java-client,代碼行數:6,代碼來源:OperationExceptionTest.java


注:本文中的net.spy.memcached.ops.OperationException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。