use of com.emc.storageos.model.systems.StorageSystemRequestParam in project coprhd-controller by CoprHD.
the class ApiTest method testOtherBadParameterErrors.
/*
* the secret key service is no longer at this address
* commenting out for now
* private void testSecretKeysTest() throws Exception {
* BalancedWebResource keyUser = rSys;
* String keyServicePath = "/secret-keys/stadmin@subtenant1.com";
* // first clear old keys (if there are such keys
*
* ClientResponse resp = keyUser.path(keyServicePath + "/all")
* .delete(ClientResponse.class);
* Assert.assertEquals(200, resp.getStatus());
*
* // Verify that the user "stadmin" does not have a key
* resp = keyUser.path(keyServicePath)
* .get(ClientResponse.class);
* Assert.assertEquals(400, resp.getStatus());
*
* //create the first key for the user stadmin
* SecretKeyInfoRep keyInfo1 = keyUser.path(keyServicePath)
* .post(SecretKeyInfoRep.class);
* Assert.assertFalse(keyInfo1._secreteKey.equals(""));
* SecretKeyRestRep userKeys = keyUser.path(keyServicePath)
* .get(SecretKeyRestRep.class);
* Assert.assertEquals(keyInfo1._secreteKey,userKeys._secreteKey1);
* Assert.assertEquals(keyInfo1._secreteKeyTimestamp,userKeys._secreteKeyTimestamp1);
* Assert.assertEquals(userKeys._secreteKey2,"");
*
* //create additional key
* SecretKeyInfoRep keyInfo2 = keyUser.path(keyServicePath)
* .post(SecretKeyInfoRep.class);
* Assert.assertFalse(keyInfo1._secreteKey.equals(""));
* userKeys = keyUser.path(keyServicePath)
* .get(SecretKeyRestRep.class);
* Assert.assertEquals(keyInfo2._secreteKey,userKeys._secreteKey2);
* Assert.assertEquals(keyInfo2._secreteKeyTimestamp,userKeys._secreteKeyTimestamp2);
*
* // No more keys can be create for the user
* resp = keyUser.path(keyServicePath)
* .post(ClientResponse.class);
* Assert.assertEquals(400, resp.getStatus());
*
* // Delete the first key and check that only 1 left in the DB
* SecretKeyService.KeyDeleteParam deleteParam = new SecretKeyService.KeyDeleteParam();
* deleteParam.key_timestamp = keyInfo1._secreteKeyTimestamp;
* resp = keyUser.path(keyServicePath)
* .delete(ClientResponse.class,deleteParam);
* Assert.assertEquals(200, resp.getStatus());
*
* userKeys = keyUser.path(keyServicePath)
* .get(SecretKeyRestRep.class);
* Assert.assertEquals(userKeys._secreteKeyTimestamp1,keyInfo2._secreteKeyTimestamp);
* Assert.assertEquals(userKeys._secreteKey2,"");
*
* //delete all key again
* resp = keyUser.path(keyServicePath + "/all")
* .delete(ClientResponse.class);
* Assert.assertEquals(200, resp.getStatus());
* }
*/
private void testOtherBadParameterErrors() {
ClientResponse resp = null;
// Test bad parameter is returned if we attempt to create a StorageSystem of an unsupported type
StorageSystemRequestParam storageSystemParam = new StorageSystemRequestParam();
storageSystemParam.setSystemType("AMadeUpOne");
storageSystemParam.setIpAddress("10.64.213.226");
storageSystemParam.setPortNumber(8080);
storageSystemParam.setUserName("MyUser");
storageSystemParam.setPassword("MyPassword");
storageSystemParam.setSerialNumber("1");
resp = rZAdmin.path("/vdc/storage-systems").post(ClientResponse.class, storageSystemParam);
Assert.assertEquals(400, resp.getStatus());
}
use of com.emc.storageos.model.systems.StorageSystemRequestParam in project coprhd-controller by CoprHD.
the class ApiTest method createIsilonDevice.
/**
* create a Isilon device.
*
* @return
* @throws InterruptedException
*/
private StorageSystemRestRep createIsilonDevice() throws InterruptedException {
StorageSystemRequestParam param = new StorageSystemRequestParam();
param.setSystemType("isilon");
param.setIpAddress(EnvConfig.get("sanity", "isilon.ip"));
param.setPortNumber(8080);
param.setUserName("root");
param.setPassword("a");
param.setSerialNumber("6805ca00ad441c3ca650a5087c0bd1674ce2");
TaskResourceRep task = rZAdmin.path("/vdc/storage-systems").post(TaskResourceRep.class, param);
String opId = task.getOpId();
Assert.assertNotNull(opId);
NamedRelatedResourceRep deviceLink = task.getResource();
Assert.assertNotNull(deviceLink);
// wait upto ~3 minute for SMIS provider scan
int checkCount = 18;
String status;
do {
Thread.sleep(10000);
TaskResourceRep taskResp = rZAdmin.path(String.format("/vdc/storage-systems/%s/tasks/%s", deviceLink.getId(), opId)).get(TaskResourceRep.class);
status = taskResp.getState();
} while (status.equals("pending") && checkCount-- > 0);
if (!status.equals("ready")) {
Assert.assertTrue("Failed to create isilon device: time out", false);
}
StorageSystemRestRep dev1 = rZAdmin.path(String.format("/vdc/storage-systems/%s", deviceLink.getId())).get(StorageSystemRestRep.class);
Assert.assertNotNull(dev1);
_log.info("Discover for device is complete : " + deviceLink.getId());
return dev1;
}
Aggregations