Search in sources :

Example 11 with CatalogCategory

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());
}
Also used : ModelClient(com.emc.sa.model.dao.ModelClient) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) BaseModelTest(com.emc.sa.model.BaseModelTest) Test(org.junit.Test)

Example 12 with CatalogCategory

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());
}
Also used : NamedURI(com.emc.storageos.db.client.model.NamedURI) ModelClient(com.emc.sa.model.dao.ModelClient) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) BaseModelTest(com.emc.sa.model.BaseModelTest) Test(org.junit.Test)

Example 13 with CatalogCategory

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;
}
Also used : CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory)

Example 14 with CatalogCategory

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;
}
Also used : NamedURI(com.emc.storageos.db.client.model.NamedURI) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI)

Example 15 with CatalogCategory

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;
}
Also used : CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory)

Aggregations

CatalogCategory (com.emc.storageos.db.client.model.uimodels.CatalogCategory)36 NamedURI (com.emc.storageos.db.client.model.NamedURI)12 CatalogCategoryMapper.createNewCatalogCategory (com.emc.sa.api.mapper.CatalogCategoryMapper.createNewCatalogCategory)9 Path (javax.ws.rs.Path)9 BaseModelTest (com.emc.sa.model.BaseModelTest)7 ModelClient (com.emc.sa.model.dao.ModelClient)7 CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)7 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)7 URI (java.net.URI)7 Consumes (javax.ws.rs.Consumes)7 Produces (javax.ws.rs.Produces)7 Test (org.junit.Test)7 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)6 PUT (javax.ws.rs.PUT)4 CatalogServiceField (com.emc.storageos.db.client.model.uimodels.CatalogServiceField)3 POST (javax.ws.rs.POST)3 CatalogACLInputFilter (com.emc.sa.api.utils.CatalogACLInputFilter)2 WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)2 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)2 GET (javax.ws.rs.GET)2