for (Token<? extends TokenIdentifier> t : cred1.getAllTokens()) {
cred2.addToken(new Text("Hdfs"), t);
}
DataOutputStream os = new DataOutputStream(new FileOutputStream(
binaryTokenFileName.toString()));
cred2.writeTokenStorageToStream(os);
os.close();
job.getConfiguration().set("mapreduce.job.credentials.binary",
binaryTokenFileName.toString());
} catch (IOException e) {
Assert.fail("Exception " + e);