use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogCategoryTest method testMultiTenant.
@Test
public void testMultiTenant() throws Exception {
_logger.info("Starting multi tenant CatalogCategory test");
ModelClient modelClient = getModelClient();
CatalogCategory root1 = createRoot("t1", "Home1");
modelClient.save(root1);
CatalogCategory root2 = createRoot("t2", "Home2");
modelClient.save(root2);
CatalogCategory root3 = createRoot("t3", "Home3");
modelClient.save(root3);
CatalogCategory root = modelClient.catalogCategories().getRootCategory("t1");
Assert.assertNotNull(root);
Assert.assertEquals("Home1", root.getLabel());
root = modelClient.catalogCategories().getRootCategory("t2");
Assert.assertNotNull(root);
Assert.assertEquals("Home2", root.getLabel());
root = modelClient.catalogCategories().getRootCategory("t3");
Assert.assertNotNull(root);
Assert.assertEquals("Home3", root.getLabel());
}
use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogCategoryTest method testFindByLabel.
@Test
public void testFindByLabel() throws Exception {
_logger.info("Starting FindByLabel test");
ModelClient modelClient = getModelClient();
CatalogCategory root = createWithLabel("root");
CatalogCategory catalogCategory = createWithLabel("foo");
catalogCategory.setCatalogCategoryId(new NamedURI(root.getId(), root.getLabel()));
modelClient.save(catalogCategory);
catalogCategory = createWithLabel("barOne");
catalogCategory.setCatalogCategoryId(new NamedURI(root.getId(), root.getLabel()));
modelClient.save(catalogCategory);
catalogCategory = createWithLabel("barTwo");
catalogCategory.setCatalogCategoryId(new NamedURI(root.getId(), root.getLabel()));
modelClient.save(catalogCategory);
modelClient.save(root);
List<CatalogCategory> results = modelClient.catalogCategories().findByLabel(DEFAULT_TENANT, "fo");
Assert.assertNotNull(results);
Assert.assertEquals(1, results.size());
results = modelClient.catalogCategories().findByLabel(DEFAULT_TENANT, "bar");
Assert.assertNotNull(results);
Assert.assertEquals(2, results.size());
results = modelClient.catalogCategories().findByLabel(DEFAULT_TENANT, "foobar");
Assert.assertNotNull(results);
Assert.assertEquals(0, results.size());
}
use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogCategoryTest method createCategory.
private CatalogCategory createCategory(String value) {
CatalogCategory model = new CatalogCategory();
model.setId(URIUtil.createId(CatalogCategory.class));
model.setLabel(value);
model.setDescription(String.format("%s description", value));
model.setImage(String.format("%s image", value));
model.setTitle(String.format("%s title", value));
model.setTenant(DEFAULT_TENANT);
return model;
}
use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogCategoryTest method createWithLabel.
private CatalogCategory createWithLabel(String label) {
CatalogCategory model = new CatalogCategory();
model.setId(URIUtil.createId(CatalogCategory.class));
model.setLabel(label);
URI parentUri = URIUtil.createId(CatalogCategory.class);
NamedURI parentId = new NamedURI(parentUri, "my parent");
model.setCatalogCategoryId(parentId);
model.setDescription("my desc");
model.setImage("my image");
model.setTitle("my title");
model.setTenant(DEFAULT_TENANT);
return model;
}
use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogServiceTest method createCategoryWithLabel.
private CatalogCategory createCategoryWithLabel(String label) {
CatalogCategory model = new CatalogCategory();
model.setLabel(label);
model.setDescription("my desc");
model.setImage("my image");
model.setTitle("my title");
return model;
}
Aggregations