Search in sources :

Example 1 with TruststoreSettingsChanges

use of com.emc.vipr.model.keystore.TruststoreSettingsChanges in project coprhd-controller by CoprHD.

the class TrustStoreTest method changeTruststoreSettingsTest.

/**
 */
public void changeTruststoreSettingsTest(boolean acceptAllCerts) {
    ClientResponse response;
    TruststoreSettings settings;
    // change the settings to the value of acceptAllCerts
    TruststoreSettingsChanges settingsChanges = new TruststoreSettingsChanges();
    settingsChanges.setAcceptAllCertificates(acceptAllCerts);
    // test PUT with a non-privileged user -should fail
    response = rRootUser2.path("/vdc/truststore/settings").put(ClientResponse.class, settingsChanges);
    Assert.assertEquals(403, response.getStatus());
    // test PUT with a security admin user -should succeed
    response = rSys.path("/vdc/truststore/settings").put(ClientResponse.class, settingsChanges);
    Assert.assertEquals(200, response.getStatus());
    settings = response.getEntity(TruststoreSettings.class);
    Assert.assertNotNull(settings);
    Assert.assertEquals(acceptAllCerts, settings.isAcceptAllCertificates());
    // a change in the truststore setting causes a reboot.
    waitForClusterToBeStable();
    // do another get to make sure the result is same as acceptAllCerts
    response = rSys.path("/vdc/truststore/settings").get(ClientResponse.class);
    Assert.assertEquals(200, response.getStatus());
    settings = response.getEntity(TruststoreSettings.class);
    Assert.assertNotNull(settings);
    Assert.assertEquals(acceptAllCerts, settings.isAcceptAllCertificates());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) TruststoreSettingsChanges(com.emc.vipr.model.keystore.TruststoreSettingsChanges) TruststoreSettings(com.emc.vipr.model.keystore.TruststoreSettings)

Aggregations

TruststoreSettings (com.emc.vipr.model.keystore.TruststoreSettings)1 TruststoreSettingsChanges (com.emc.vipr.model.keystore.TruststoreSettingsChanges)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1