@Test
  public void testGetCommandExisting() throws Exception {
    String alias = "javax.jdo.option.ConnectionPassword";
    String credential = "MyTopSecretPassword";
    String providerPath = getProviderPath("CreateCommandTest.jceks");
    String[] args;
    int exitCode;

    /*
     * Create a new credential
     */
    args = getCreateArgs(alias, credential, providerPath);
    exitCode = executeCommand(args);
    Assert.assertEquals(exitCode, 0);
    out.reset();

    /*
     * Get the existing credential.
     */
    args = getGetArgs(alias, providerPath);
    exitCode = executeCommand(args);
    Assert.assertEquals(exitCode, 0);

    String retrievedCredential = out.toString().trim();
    Assert.assertEquals(credential, retrievedCredential);
  }
Retrieve an existing credential.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/credentialapi/CredentialUtilTest.java