/** attempts to access tokenCache as from client */ @Override public void map(IntWritable key, IntWritable value, Context context) throws IOException, InterruptedException { // get token storage and a key Credentials ts = context.getCredentials(); byte[] key1 = ts.getSecretKey(new Text("alias1")); Collection<Token<? extends TokenIdentifier>> dts = ts.getAllTokens(); int dts_size = 0; if (dts != null) dts_size = dts.size(); if (dts_size != 2) { // one job token and one delegation token throw new RuntimeException("tokens are not available"); // fail the test } if (key1 == null || ts == null || ts.numberOfSecretKeys() != NUM_OF_KEYS) { throw new RuntimeException("secret keys are not available"); // fail the test } super.map(key, value, context); }