use of org.ovirt.engine.api.model.Option in project ovirt-engine by oVirt.
the class BackendGlusterVolumeResourceTest method testSetOptionInvalidParams.
@Test
public void testSetOptionInvalidParams() throws Exception {
setUriInfo(setUpBasicUriExpectations());
resource.setUriInfo(setUpBasicUriExpectations());
try {
Action action = new Action();
action.setOption(new Option());
resource.setOption(action);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Option", "setOption", "name, value");
}
}
use of org.ovirt.engine.api.model.Option in project ovirt-engine by oVirt.
the class BackendGlusterVolumeResourceTest method testResetOptionInvalidParams.
@Test
public void testResetOptionInvalidParams() throws Exception {
setUriInfo(setUpBasicUriExpectations());
resource.setUriInfo(setUpBasicUriExpectations());
try {
Action action = new Action();
action.setOption(new Option());
resource.resetOption(action);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Option", "resetOption", "name");
}
}
use of org.ovirt.engine.api.model.Option in project ovirt-engine by oVirt.
the class BackendGlusterVolumeResourceTest method testSetOption.
@Test
public void testSetOption() throws Exception {
setupParentExpectations();
resource.setParent(volumesResourceMock);
setUriInfo(setUpActionExpectations(ActionType.SetGlusterVolumeOption, GlusterVolumeOptionParameters.class, new String[] { "VolumeId" }, new Object[] { GUIDS[0] }));
Action action = new Action();
action.setOption(new Option());
action.getOption().setName("auth.allow");
action.getOption().setValue("*");
verifyActionResponse(resource.setOption(action));
}
use of org.ovirt.engine.api.model.Option in project ovirt-engine by oVirt.
the class FenceOptionsParser method parseOption.
/* Format is <name=value>
*/
private static Option parseOption(String str, Map<String, String> types, boolean ignoreValues) {
String[] parts = str.split("=", -1);
if (parts.length != 2) {
log.error("Invalid fencing option description \"{}\".", str);
return null;
}
Option ret = new Option();
ret.setName(parts[0]);
if (!ignoreValues) {
ret.setValue(parts[1]);
}
if (types.containsKey(parts[0])) {
ret.setType(types.get(parts[0]));
} else {
log.error("No type specified for fencing option \"{}\".", parts[0]);
return null;
}
return ret;
}
use of org.ovirt.engine.api.model.Option in project ovirt-engine by oVirt.
the class FenceOptionsParserTest method verifyResult.
private void verifyResult(Agent result, String type, String... options) {
assertEquals(type, result.getType());
assertNotNull(result.getOptions());
assertEquals(options.length, result.getOptions().getOptions().size() * 3);
for (int i = 0; i < options.length; i += 3) {
Option opt = result.getOptions().getOptions().get(i / 3);
assertEquals(options[i], opt.getName());
assertEquals(options[i + 1], opt.getType());
assertEquals(options[i + 2], opt.getValue());
}
}
Aggregations