Search in sources :

Example 1 with ReturnCode

use of com.cloud.hypervisor.ovm3.objects.CloudstackPlugin.ReturnCode in project cloudstack by apache.

the class CloudStackPluginTest method testDomrExec.

@Test
public void testDomrExec() throws Ovm3ResourceException {
    con.setResult(domrExecXml);
    ReturnCode x = cSp.domrExec(domrIp, "ls");
    assertNotNull(x);
    assertEquals(x.getExit(), (Integer) 0);
    assertEquals(x.getRc(), true);
    assertEquals(x.getExit(), (Integer) 0);
    assertNotNull(x.getStdOut());
    /* failed */
    domrExecXml = domrExecXml.replace("<i8>0</i8>", "<i8>1</i8>");
    domrExecXml = domrExecXml.replace("<value><string></string></value>", "<value><string>Something went wrong!</string></value>");
    con.setResult(domrExecXml);
    ReturnCode y = cSp.domrExec(domrIp, "ls");
    assertNotNull(y);
    assertEquals(y.getRc(), false);
    assertEquals(y.getExit(), (Integer) 1);
    assertNotNull(x.getStdErr());
}
Also used : ReturnCode(com.cloud.hypervisor.ovm3.objects.CloudstackPlugin.ReturnCode) Test(org.junit.Test)

Aggregations

ReturnCode (com.cloud.hypervisor.ovm3.objects.CloudstackPlugin.ReturnCode)1 Test (org.junit.Test)1