/** * Test CancelDelegationTokenRequestPBImpl. * Test a transformation to prototype and back */ @Test public void testCancelDelegationTokenRequestPBImpl() { Token token = getDelegationToken(); CancelDelegationTokenRequestPBImpl original = new CancelDelegationTokenRequestPBImpl(); original.setDelegationToken(token); CancelDelegationTokenRequestProto protoType = original.getProto(); CancelDelegationTokenRequestPBImpl copy = new CancelDelegationTokenRequestPBImpl(protoType); assertNotNull(copy.getDelegationToken()); //compare source and converted assertEquals(token, copy.getDelegationToken()); }
@Override public CancelDelegationTokenResponse cancelDelegationToken( CancelDelegationTokenRequest request) throws YarnException, IOException { CancelDelegationTokenRequestProto requestProto = ((CancelDelegationTokenRequestPBImpl) request).getProto(); try { return new CancelDelegationTokenResponsePBImpl( proxy.cancelDelegationToken(null, requestProto)); } catch (ServiceException e) { RPCUtil.unwrapAndThrowException(e); return null; } }
@Override public CancelDelegationTokenRequestProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
@Override public CancelDelegationTokenResponseProto cancelDelegationToken( RpcController controller, CancelDelegationTokenRequestProto proto) throws ServiceException { CancelDelegationTokenRequestPBImpl request = new CancelDelegationTokenRequestPBImpl(proto); try { CancelDelegationTokenResponse response = real.cancelDelegationToken(request); return ((CancelDelegationTokenResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Override public CancelDelegationTokenResponse cancelDelegationToken( CancelDelegationTokenRequest request) throws IOException { CancelDelegationTokenRequestProto requestProto = ((CancelDelegationTokenRequestPBImpl) request).getProto(); try { return new CancelDelegationTokenResponsePBImpl( proxy.cancelDelegationToken(null, requestProto)); } catch (ServiceException e) { throw unwrapAndThrowException(e); } }
@Override public CancelDelegationTokenResponseProto cancelDelegationToken( RpcController controller, CancelDelegationTokenRequestProto req) throws ServiceException { try { server.cancelDelegationToken(PBHelper.convertDelegationToken(req .getToken())); return VOID_CANCELDELEGATIONTOKEN_RESPONSE; } catch (IOException e) { throw new ServiceException(e); } }
@Override public void cancelDelegationToken(Token<DelegationTokenIdentifier> token) throws IOException { CancelDelegationTokenRequestProto req = CancelDelegationTokenRequestProto .newBuilder() .setToken(PBHelper.convert(token)) .build(); try { rpcProxy.cancelDelegationToken(null, req); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } }
@Override public void cancelDelegationToken(Token<DelegationTokenIdentifier> token) throws IOException { CancelDelegationTokenRequestProto req = CancelDelegationTokenRequestProto .newBuilder() .setToken(PBHelperClient.convert(token)) .build(); try { rpcProxy.cancelDelegationToken(null, req); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } }
@Override public CancelDelegationTokenResponseProto cancelDelegationToken( RpcController controller, CancelDelegationTokenRequestProto req) throws ServiceException { try { server.cancelDelegationToken(PBHelperClient.convertDelegationToken(req .getToken())); return VOID_CANCELDELEGATIONTOKEN_RESPONSE; } catch (IOException e) { throw new ServiceException(e); } }