Credentials implements Writable { public void addAll(Credentials other) { addAll(other, true); } Credentials();  Credentials(Credentials credentials); Token<? extends TokenIdentifier> getToken(Text alias); void addToken(Text alias, Token<? extends TokenIdentifier> t); Collection<Token<? extends TokenIdentifier>> getAllTokens(); int numberOfTokens(); byte[] getSecretKey(Text alias); int numberOfSecretKeys(); void addSecretKey(Text alias, byte[] key); void removeSecretKey(Text alias); List<Text> getAllSecretKeys(); static Credentials readTokenStorageFile(Path filename,
                                                 Configuration conf); static Credentials readTokenStorageFile(File filename,
                                                 Configuration conf); void readTokenStorageStream(DataInputStream in); void writeTokenStorageToStream(DataOutputStream os); void writeTokenStorageToStream(DataOutputStream os,
      SerializedFormat format); void writeTokenStorageFile(Path filename,
                                    Configuration conf); void writeTokenStorageFile(Path filename, Configuration conf,
      SerializedFormat format); @Override void write(DataOutput out); @Override void readFields(DataInput in); void addAll(Credentials other); void mergeAll(Credentials other);  }
@Test public void addAll() { Credentials creds = new Credentials(); creds.addToken(service[0], token[0]); creds.addToken(service[1], token[1]); creds.addSecretKey(secret[0], secret[0].getBytes()); creds.addSecretKey(secret[1], secret[1].getBytes()); Credentials credsToAdd = new Credentials(); credsToAdd.addToken(service[0], token[3]); credsToAdd.addToken(service[2], token[2]); credsToAdd.addSecretKey(secret[0], secret[3].getBytes()); credsToAdd.addSecretKey(secret[2], secret[2].getBytes()); creds.addAll(credsToAdd); assertEquals(3, creds.numberOfTokens()); assertEquals(3, creds.numberOfSecretKeys()); assertEquals(token[3], creds.getToken(service[0])); assertEquals(secret[3], new Text(creds.getSecretKey(secret[0]))); assertEquals(token[1], creds.getToken(service[1])); assertEquals(secret[1], new Text(creds.getSecretKey(secret[1]))); assertEquals(token[2], creds.getToken(service[2])); assertEquals(secret[2], new Text(creds.getSecretKey(secret[2]))); }