本文整理汇总了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());
}
}
示例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"));
}
示例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));
}
示例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));
}
示例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));
}
示例6: getException
import net.spy.memcached.ops.OperationException; //导入依赖的package包/类
public final OperationException getException() {
return exception;
}
示例7: getException
import net.spy.memcached.ops.OperationException; //导入依赖的package包/类
public OperationException getException() {
return null;
}
示例8: getException
import net.spy.memcached.ops.OperationException; //导入依赖的package包/类
public final OperationException getException() {
return exception;
}
示例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));
}