use of com.emc.storageos.db.client.model.uimodels.CatalogService 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.CatalogService in project coprhd-controller by CoprHD.
the class CatalogServiceTest method testReparent.
@Test
public void testReparent() throws Exception {
_logger.info("Starting reparent CatalogService test");
ModelClient modelClient = getModelClient();
CatalogCategory parent1 = createCategoryWithLabel("Parent 1");
modelClient.save(parent1);
CatalogCategory parent2 = createCategoryWithLabel("Parent 2");
modelClient.save(parent2);
CatalogService service = createWithLabel("Service");
setParent(parent1, service);
modelClient.save(service);
List<CatalogService> parent1Children = modelClient.catalogServices().findByCatalogCategory(parent1.getId());
Assert.assertEquals(1, parent1Children.size());
Assert.assertEquals(service.getId(), parent1Children.get(0).getId());
List<CatalogService> parent2Children = modelClient.catalogServices().findByCatalogCategory(parent2.getId());
Assert.assertEquals(0, parent2Children.size());
setParent(parent2, service);
modelClient.save(service);
parent1Children = modelClient.catalogServices().findByCatalogCategory(parent1.getId());
Assert.assertEquals(0, parent1Children.size());
parent2Children = modelClient.catalogServices().findByCatalogCategory(parent2.getId());
Assert.assertEquals(1, parent2Children.size());
Assert.assertEquals(service.getId(), parent2Children.get(0).getId());
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogServiceTest method testPersistObject.
@Test
public void testPersistObject() throws Exception {
_logger.info("Starting persist CatalogService test");
CatalogService model = new CatalogService();
model.setId(URIUtil.createId(CatalogService.class));
model.setLabel("foo");
model.setApprovalRequired(true);
model.setBaseService("my service");
URI ewUri = URIUtil.createId(ExecutionWindow.class);
NamedURI ewId = new NamedURI(ewUri, "ewId");
model.setDefaultExecutionWindowId(ewId);
model.setDescription("my desc");
model.setExecutionWindowRequired(true);
model.setImage("my image");
model.setMaxSize(42);
model.setTitle("my title");
save(model);
model = findById(model.getId());
Assert.assertNotNull(model);
Assert.assertEquals("foo", model.getLabel());
Assert.assertEquals(true, model.getApprovalRequired());
Assert.assertEquals("my service", model.getBaseService());
Assert.assertEquals(ewId, model.getDefaultExecutionWindowId());
Assert.assertEquals("my desc", model.getDescription());
Assert.assertEquals(true, model.getExecutionWindowRequired());
Assert.assertEquals("my image", model.getImage());
Assert.assertEquals(new Integer(42), model.getMaxSize());
Assert.assertEquals("my title", model.getTitle());
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogServiceTest method createWithLabel.
private CatalogService createWithLabel(String label) {
CatalogService model = new CatalogService();
model.setLabel(label);
model.setApprovalRequired(true);
model.setBaseService("my service");
URI ewUri = URIUtil.createId(ExecutionWindow.class);
NamedURI ewId = new NamedURI(ewUri, "ewId");
model.setDefaultExecutionWindowId(ewId);
model.setDescription("my desc");
model.setExecutionWindowRequired(true);
model.setImage("my image");
model.setMaxSize(42);
model.setTitle("my title");
return model;
}
Aggregations