URLConnection connectionGood = url.openConnection();
TaskTracker tt = new TaskTracker();
JobTokenSecretManager jtSecretManager = new JobTokenSecretManager();
// create fake TaskTracker - needed for keys storage
JobTokenIdentifier identifier = new JobTokenIdentifier(new Text(JOB_ID));
Token<JobTokenIdentifier> jt = new Token<JobTokenIdentifier>(identifier,
jtSecretManager);
SecretKey tokenSecret = JobTokenSecretManager.createSecretKey(jt.getPassword());
addJobToken(tt, JOB_ID, jt); // fake id
server.setAttribute("task.tracker", tt);
// encode the url
String urlHashGood = SecureShuffleUtils.generateHash(enc_str.getBytes(), tokenSecret); // valid hash
// another the key
JobTokenIdentifier badIdentifier = new JobTokenIdentifier(new Text(BAD_JOB_ID));
Token<JobTokenIdentifier> badToken = new Token<JobTokenIdentifier>(badIdentifier,
jtSecretManager);
SecretKey badSecret = JobTokenSecretManager.createSecretKey(badToken.getPassword());
String urlHashBad = SecureShuffleUtils.generateHash(enc_str.getBytes(), badSecret); // invalid hash