use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class BackendGlusterHooksResourceTest method setupListExpectations.
private void setupListExpectations() {
Cluster cluster = new Cluster();
cluster.setName(defaultClusterName);
cluster.setId(clusterId.toString());
parentMock = mock(ClusterResource.class);
when(parentMock.get()).thenReturn(cluster);
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class BackendGlusterHooksResourceTest method init.
/**
* Override init to perform additional mocking required
* for the "list" method of the collection resource.
*/
@Override
protected void init() {
super.init();
parentMock = mock(BackendClusterResource.class);
Cluster cluster = new Cluster();
cluster.setId(clusterId.toString());
when(parentMock.get()).thenReturn(cluster);
collection.setParent(parentMock);
setupListExpectations();
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class V3ClusterInAdapter method adapt.
@Override
public Cluster adapt(V3Cluster from) {
Cluster to = new Cluster();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetBallooningEnabled()) {
to.setBallooningEnabled(from.isBallooningEnabled());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetCpu()) {
to.setCpu(adaptIn(from.getCpu()));
}
if (from.isSetDataCenter()) {
to.setDataCenter(adaptIn(from.getDataCenter()));
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDisplay()) {
to.setDisplay(adaptIn(from.getDisplay()));
}
if (from.isSetErrorHandling()) {
to.setErrorHandling(adaptIn(from.getErrorHandling()));
}
if (from.isSetFencingPolicy()) {
to.setFencingPolicy(adaptIn(from.getFencingPolicy()));
}
if (from.isSetGlusterService()) {
to.setGlusterService(from.isGlusterService());
}
if (from.isSetHaReservation()) {
to.setHaReservation(from.isHaReservation());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetKsm()) {
to.setKsm(adaptIn(from.getKsm()));
}
if (from.isSetMaintenanceReasonRequired()) {
to.setMaintenanceReasonRequired(from.isMaintenanceReasonRequired());
}
if (from.isSetManagementNetwork()) {
to.setManagementNetwork(adaptIn(from.getManagementNetwork()));
}
if (from.isSetMemoryPolicy()) {
to.setMemoryPolicy(adaptIn(from.getMemoryPolicy()));
}
if (from.isSetMigration()) {
to.setMigration(adaptIn(from.getMigration()));
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOptionalReason()) {
to.setOptionalReason(from.isOptionalReason());
}
if (from.isSetRequiredRngSources()) {
to.setRequiredRngSources(new Cluster.RequiredRngSourcesList());
to.getRequiredRngSources().getRequiredRngSources().addAll(adaptRngSources(from));
}
if (from.isSetSchedulingPolicy()) {
to.setSchedulingPolicy(adaptIn(from.getSchedulingPolicy()));
}
if (from.isSetSerialNumber()) {
to.setSerialNumber(adaptIn(from.getSerialNumber()));
}
if (from.isSetSupportedVersions()) {
to.setSupportedVersions(new Versions());
to.getSupportedVersions().getVersions().addAll(adaptIn(from.getSupportedVersions().getVersions()));
}
if (from.isSetThreadsAsCores()) {
to.setThreadsAsCores(from.isThreadsAsCores());
}
if (from.isSetTrustedService()) {
to.setTrustedService(from.isTrustedService());
}
if (from.isSetTunnelMigration()) {
to.setTunnelMigration(from.isTunnelMigration());
}
if (from.isSetVersion()) {
to.setVersion(adaptIn(from.getVersion()));
}
if (from.isSetVirtService()) {
to.setVirtService(from.isVirtService());
}
return to;
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class V3ClusterServer method update.
@PUT
@Consumes({ "application/xml", "application/json" })
public V3Cluster update(V3Cluster v3Cluster) {
Cluster v4Cluster = adaptIn(v3Cluster);
assignCompatiblePolicy(v3Cluster, v4Cluster);
try {
return adaptOut(getDelegate().update(v4Cluster));
} catch (WebApplicationException exception) {
throw adaptException(exception);
}
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class V3ClustersServer method add.
@POST
@Consumes({ "application/xml", "application/json" })
public Response add(V3Cluster v3Cluster) {
Cluster v4Cluster = adaptIn(v3Cluster);
assignCompatiblePolicy(v3Cluster, v4Cluster);
try {
return adaptResponse(getDelegate().add(v4Cluster));
} catch (WebApplicationException exception) {
throw adaptException(exception);
}
}
Aggregations