use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class ExecutionEngineImplTest method createOrder.
protected Order createOrder(String name, Map<String, String> params) {
ExecutionState state = new ExecutionState();
modelClient.save(state);
Order order = new Order();
order.setExecutionStateId(state.getId());
CatalogService service = new CatalogService();
service.setLabel(name);
modelClient.save(service);
order.setCatalogServiceId(service.getId());
modelClient.save(order);
int index = 0;
for (Map.Entry<String, String> entry : params.entrySet()) {
OrderParameter param = new OrderParameter();
param.setLabel(entry.getKey());
param.setValue(entry.getValue());
param.setOrderId(order.getId());
modelClient.save(param);
}
return order;
}
use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class OrderParameterTest method create.
protected static OrderParameter create(String name, String value) {
OrderParameter model = new OrderParameter();
model.setLabel(name);
model.setFriendlyLabel(name);
model.setFriendlyValue(value);
model.setValue(value);
return model;
}
use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class SortedIndexTest method testSorting.
@Test
public void testSorting() {
Order o1 = createOrder(OrderStatus.PENDING);
ModelClient modelClient = getModelClient();
modelClient.save(o1);
OrderParameter op1 = createOrderParameter("op1", "op1Value", 2);
op1.setOrderId(o1.getId());
modelClient.save(op1);
OrderParameter op2 = createOrderParameter("op2", "op2Value", 1);
op2.setOrderId(o1.getId());
modelClient.save(op2);
OrderParameter op3 = createOrderParameter("op3", "op3Value", 3);
op3.setOrderId(o1.getId());
modelClient.save(op3);
List<OrderParameter> orderParameters = modelClient.orderParameters().findByOrderId(o1.getId());
Assert.assertNotNull(orderParameters);
Assert.assertEquals(3, orderParameters.size());
Assert.assertEquals(op2.getLabel(), orderParameters.get(0).getLabel());
Assert.assertEquals(op1.getLabel(), orderParameters.get(1).getLabel());
Assert.assertEquals(op3.getLabel(), orderParameters.get(2).getLabel());
SortedIndexUtils.moveDown(op1, modelClient);
orderParameters = modelClient.orderParameters().findByOrderId(o1.getId());
Assert.assertNotNull(orderParameters);
Assert.assertEquals(3, orderParameters.size());
Assert.assertEquals(op2.getLabel(), orderParameters.get(0).getLabel());
Assert.assertEquals(op3.getLabel(), orderParameters.get(1).getLabel());
Assert.assertEquals(op1.getLabel(), orderParameters.get(2).getLabel());
SortedIndexUtils.moveUp(op3, modelClient);
orderParameters = modelClient.orderParameters().findByOrderId(o1.getId());
Assert.assertNotNull(orderParameters);
Assert.assertEquals(3, orderParameters.size());
Assert.assertEquals(op3.getLabel(), orderParameters.get(0).getLabel());
Assert.assertEquals(op2.getLabel(), orderParameters.get(1).getLabel());
Assert.assertEquals(op1.getLabel(), orderParameters.get(2).getLabel());
OrderParameter op4 = createOrderParameter("op4", "op4Value", null);
op4.setOrderId(o1.getId());
modelClient.save(op4);
orderParameters = modelClient.orderParameters().findByOrderId(o1.getId());
Assert.assertNotNull(orderParameters);
Assert.assertEquals(4, orderParameters.size());
Assert.assertEquals(op3.getLabel(), orderParameters.get(0).getLabel());
Assert.assertEquals(op2.getLabel(), orderParameters.get(1).getLabel());
Assert.assertEquals(op1.getLabel(), orderParameters.get(2).getLabel());
Assert.assertEquals(op4.getLabel(), orderParameters.get(3).getLabel());
}
use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class ServiceRunner method createParam.
private static OrderParameter createParam(String name, String value) {
OrderParameter param = new OrderParameter();
param.setLabel(name);
param.setValue(value);
return save(param);
}
use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class ServiceRunner method createOrder.
public static Order createOrder(String name, Map<String, String> params) {
init();
Order order = new Order();
order.setCatalogServiceId(createService(name).getId());
order = save(order);
for (Map.Entry<String, String> entry : params.entrySet()) {
OrderParameter param = createParam(entry.getKey(), entry.getValue());
param.setOrderId(order.getId());
getModels().save(param);
}
return order;
}
Aggregations