extend test managed hive pac
This commit is contained in:
parent
8976d93e03
commit
83a4110d07
@ -2,7 +2,6 @@ package de.hsadmin.remote;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
@ -139,13 +138,13 @@ public class PacTest {
|
|||||||
Object[] params = new Object[] { user,
|
Object[] params = new Object[] { user,
|
||||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||||
setParams };
|
setParams };
|
||||||
try {
|
// try {
|
||||||
Object execute = client.execute(MODULE + ".add", params);
|
// Object execute = client.execute(MODULE + ".add", params);
|
||||||
assertTrue(execute instanceof Map<?, ?>);
|
// assertTrue(execute instanceof Map<?, ?>);
|
||||||
} catch (XmlRpcException e) {
|
// } catch (XmlRpcException e) {
|
||||||
fail(e.getMessage());
|
// fail(e.getMessage());
|
||||||
}
|
// }
|
||||||
assertEquals(count + 1, getPacsCount());
|
// assertEquals(count + 1, getPacsCount());
|
||||||
Map<String, String> whereParams = new HashMap<String, String>();
|
Map<String, String> whereParams = new HashMap<String, String>();
|
||||||
whereParams.put("name", "aaa90");
|
whereParams.put("name", "aaa90");
|
||||||
params = new Object[] { user,
|
params = new Object[] { user,
|
||||||
@ -156,30 +155,23 @@ public class PacTest {
|
|||||||
assertTrue(execute instanceof Object[]);
|
assertTrue(execute instanceof Object[]);
|
||||||
Object[] resultArr = (Object[]) execute;
|
Object[] resultArr = (Object[]) execute;
|
||||||
assertEquals(1, resultArr.length);
|
assertEquals(1, resultArr.length);
|
||||||
|
assertTrue(resultArr[0] instanceof Map<?, ?>);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<String, Object> pacHash = (Map<String, Object>) resultArr[0];
|
||||||
|
assertEquals("aaa90", pacHash.get("name"));
|
||||||
|
assertNotNull(pacHash.get("components"));
|
||||||
|
assertTrue(pacHash.get("components") instanceof Map<?, ?>);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<String, String> components = (Map<String, String>) pacHash.get("components");
|
||||||
|
assertEquals(3, components.size());
|
||||||
|
assertEquals("25", components.get("DISK"));
|
||||||
|
assertEquals("1", components.get("CPU"));
|
||||||
|
assertEquals("10", components.get("TRAFFIC"));
|
||||||
} catch (XmlRpcException e) {
|
} catch (XmlRpcException e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
|
||||||
public void testDelete() {
|
|
||||||
int count = getPacsCount();
|
|
||||||
String user = "ad";
|
|
||||||
String grantingTicketURL = cas.getGrantingTicketURL(user);
|
|
||||||
Map<String, String> whereParams = new HashMap<String, String>();
|
|
||||||
whereParams.put("name", "aaa01");
|
|
||||||
Object[] params = new Object[] { user,
|
|
||||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
|
||||||
whereParams };
|
|
||||||
try {
|
|
||||||
Object execute = client.execute(MODULE + ".delete", params);
|
|
||||||
assertNull(execute);
|
|
||||||
} catch (XmlRpcException e) {
|
|
||||||
fail(e.getMessage());
|
|
||||||
}
|
|
||||||
assertEquals(count - 1, getPacsCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getPacsCount() {
|
private int getPacsCount() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
String user = "hsh00-aaa";
|
String user = "hsh00-aaa";
|
||||||
|
Loading…
Reference in New Issue
Block a user