use of org.ovirt.engine.api.model.Tag in project ovirt-engine by oVirt.
the class BackendTagsResourceTest method testAddTagNamedParent.
@Test
public void testAddTagNamedParent() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpEntityQueryExpectations(QueryType.GetTagByTagName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[PARENT_IDX] }, getEntity(PARENT_IDX));
setUpCreationExpectations(ActionType.AddTag, TagsOperationParameters.class, new String[] { "Tag.TagName", "Tag.ParentId" }, new Object[] { NAMES[0], PARENT_GUID }, true, true, null, QueryType.GetTagByTagName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[0] }, getEntity(0));
Tag model = getModel(0);
model.getParent().setId(null);
model.getParent().setName(NAMES[PARENT_IDX]);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Tag);
verifyModel((Tag) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.Tag in project ovirt-engine by oVirt.
the class BackendTagsResourceTest method testAddIncompleteParameters.
@Test
public void testAddIncompleteParameters() throws Exception {
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(new Tag());
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Tag", "add", "name");
}
}
use of org.ovirt.engine.api.model.Tag in project ovirt-engine by oVirt.
the class BackendTagsResourceTest method testListLimitResults.
@Test
public void testListLimitResults() throws Exception {
UriInfo uriInfo = setUpUriExpectationsWithMax(false);
setUpQueryExpectations("");
collection.setUriInfo(uriInfo);
List<Tag> results = getCollection();
assertNotNull(collection);
assertEquals(3, results.size());
}
use of org.ovirt.engine.api.model.Tag in project ovirt-engine by oVirt.
the class BackendTagsResourceTest method testAddTag.
@Test
public void testAddTag() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(ActionType.AddTag, TagsOperationParameters.class, new String[] { "Tag.TagName", "Tag.ParentId" }, new Object[] { NAMES[0], PARENT_GUID }, true, true, null, QueryType.GetTagByTagName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[0] }, getEntity(0));
Response response = collection.add(getModel(0));
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Tag);
verifyModel((Tag) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.Tag in project ovirt-engine by oVirt.
the class AbstractBackendAssignedTagsResourceTest method testAddTag.
@Test
public void testAddTag() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(attachAction, attachParams, new String[] { "TagId", "EntitiesId" }, new Object[] { GUIDS[0], asList(PARENT_GUID) }, true, true, null, QueryType.GetTagByTagId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, setUpTags().get(0));
Tag model = new Tag();
model.setId(GUIDS[0].toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Tag);
verifyModel((Tag) response.getEntity(), 0);
}
Aggregations