/** * 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; } }
@Test public void testCancelDelegationTokenRequestPBImpl() throws Exception { validatePBImplRecord(CancelDelegationTokenRequestPBImpl.class, CancelDelegationTokenRequestProto.class); }