当前位置: 首页>>代码示例>>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;未经允许,请勿转载。