@Test
public void testFailNotInitialized() throws Exception {

  Configuration configuration = new Configuration(new Properties());
  CredentialStoreService uninitializedCredentialStoreService = new CredentialStoreServiceImpl(configuration, new SecurePasswordHelper());
  PrincipalKeyCredential credential1 = new PrincipalKeyCredential("username1", "password1");
  // The temporary store should always be initialized.... this should succeed.
  uninitializedCredentialStoreService.setCredential(CLUSTER_NAME, "test1", credential1, CredentialStoreType.TEMPORARY);
  try {
    uninitializedCredentialStoreService.setCredential(CLUSTER_NAME, "test1", credential1, CredentialStoreType.PERSISTED);
    Assert.fail("AmbariException should have been thrown");
  } catch (AmbariException e) {
    // This is expected...
  }
}