I got on TFS this setup:
Static group [SG1]
[t1]
[t2]
[t3]
I'd like to make a query that give me access to the t1,t2,t3 under the SG1 group in order to make other operation. Usually i would make a "tree" query and set filter the father/son relationship.
But since it's a static group, it got no child to be displayed.
Is there a workaround to retrive all elements contained in a suiteId?
Thanks
You need to use Test Suites - Get Test Cases to get all test cases in a suite.
GET https://dev.azure.com/{organization}/{project}/_apis/test/Plans/{planId}/suites/{suiteId}/testcases?api-version=5.0
Related
I have the following code
PagedResultList res = myService.getPage(paginateParams, ...)
println res.size() // returns 2
println res.getTotalCount() // returns 1
getPage looks like:
def criteria = MyDomain.createCriteria()
criteria.list(max: paginateParams.max, offset: paginateParams.offset) { // max is 10, offset is 0, sortBy is updatedAt and sortOrder is desc
eq('org', org)
order(paginateParams.sortBy, paginateParams.sortOrder)
}
why do the two method return different values? The documentation doesn't explain the difference, but does mention that getTotalCount is for number of records
currently on grails 2.4.5
edits:
println on res prints out:
res: [
com.<hidden>.MyDomain: 41679f98-a7c5-4193-bba8-601725007c1a,
com.<hidden>.MyDomain: 41679f98-a7c5-4193-bba8-601725007c1a]
Yes, res has a SINGLE object twice - that's the bug I'm trying to fix. How do I know that? I have an primary key on MyDomain's ID, and when I inspect the database, it's also showing one record for this particular org (see my criteria)
edit 2: I found this comment (http://docs.grails.org/2.4.5/ref/Domain%20Classes/createCriteria.html)
listDistinct If subqueries or associations are used, one may end up
with the same row multiple times in the result set. In Hibernate one
would do a "CriteriaSpecification.DISTINCT_ROOT_ENTITY". In Grails one
can do it by just using this method.
Which, if I understand correctly, is their way of saying "list" method doesn't work in this scenario, use listDistinct instead but then they go on to warn:
The listDistinct() method does not work well with the pagination
options maxResult and firstResult. If you need distinct results with
pagination, we currently recommend that you use HQL. You can find out
more information from this blog post.
However, the blog post is a dead link.
Related: GORM createCriteria and list do not return the same results : what can I do?
Not related to actual problem after question edited but this quote seems useful
Generally PagedResultList .size() perform size() on resultList property (in-memory object represent database record), while .getTotalCount() do count query against database. If this two value didn't match your list may contain duplicate.
After viewing related issues (GORM createCriteria and list do not return the same results : what can I do?) I determined that there were several approaches:
Use grails projection groupBy('id') - doesn't work b/c i need the entire object
USe HSQL - Domain.executeQuery - actually this didn't work for my scenario very well because this returns a list, whereas criteria.list returns a PagedResultList from which I previously got totalCount. This solution had me learning HSQL and also made me break up my existing logic into two components - one that returned PagedResultList and one that didn't
Simply keep a set of IDs as I process my PagedResultList and make sure that I didn't have any duplicates.
I ended up going with option 3 because it was quick, didn't require me to learn a new language (HSQL) and I felt that I could easily write the code to do it and I'm not limited by the CPU to do such a unique ID check.
We've moved to the "Single Team Project" way of working, and thus our different teams are split up into different areas (because that works for us).
Our URLs are http://tfsserver/ProjectA, http://tfsserver//ProjectB etc.. etc.. which auto populates the Area, and thus makes sure all the work items go into the correct place.
However, all our queries are very simple for each team. This has led us to have query folders which duplicate many of the queries, but scope down to single areas, to make sure that query only targets the right work items.
Is there a #CurrentTeam macro which we can apply to our queries to prevent duplicating all our queries?
We can't be the only people with this problem can we - or we're doing it wrong.
No, there's no such thing right now in TFS. The only predefined macros are: #project, #me and #today. You can create your own macros when using TFS object model for running queries but there's no way to do it in the UI.
Sample code:
var tpc = new TfsTeamProjectCollection(new Uri("http://localhost:8080/tfs/DefaultCollection"));
var store = tpc.GetService<WorkItemStore>();
Query query = new Query(store, "select * from workitems where System.AreaPath = #TeamArea", new Dictionary<string, string>() { { "TeamArea", "<Team area path>" } });
query.RunQuery();
Im very newbie to iOS programming.
I have core data app for tasks with two entities: Group and Task.
User creates task groups like Work, Home, Shoping and tasks related to these groups like for Work-Deploy an app, for Shopping-buy milk etc.
I have two view controllers.
Problem is that now when user clicks on a Group in tableView, it gets to next viewController, where tasks from all groups are listed. So, how I could show only Group (selected in tableView) related Tasks?
For now when for exapmle I click on Work group I see Deploy an app and Buy milk etc tasks.. I guess its something wrong with NSFetchRequest or NSPredicate Thanks!
Create an NSPredicate to have task == the task from selected cell. Use this predicate filter the the NSSet that you get when asking for the tasks property on the group-class.
If you already did this, please show the code that is doing this, so we can see what exactly is that is going wrong.
Can you also give a screenshot of (the relevant part of) your model and indicate whether you have NSManagedObject subclasses for the entities?
I have a grails application where I have contacts which belongs to another domain contactGroup. It all seems to be working fine except for removeFromContacts method. I am using following code. The code works correctly but removes only one contact from the group at a time. I even did some debugging and the foreach loop runs as many times as the contacts provided. There is no error message. Any idea what could be going wrong -
ContactGroup group = ContactGroup.findByIdAndOwner(params.groupId, user)
def contactIds = request.JSON.data.contact
contactIds.each {
Contact contact = Contact.findByContactIdAndOwner(it.contactId, user)
if(contact) {
group.removeFromContacts(contact)
}
}
I've read a few things about the findAll methods loading proxies if the associations are lazy-loaded rather than the "real" instance.
Try this:
group.removeFromContacts(Contact.get(contact.id))
The 'get' should bypass the proxies and use the "real" instance. There is a JIRA that talks about this (Grails-5804). An overall fix according to the JIRA (from Burt Beckwith) is to implement the equals and hashCode method in your Contact class.
Thanks for all your support. I realized that I have not defined the relationship at the domain level correctly and that was messing up with the whole thing. When I corrected that it was working correctly.
saurabh
so if i have a model Student, which Tests and Homework reference, is there a way using the Model or Table class of Student which returns Tests and Homework? Essentially I want to manually do "on delete cascade" without necessarily knowing the tables Ineed to delete -- I was hoping to get these tables from one of Doctrine's methods.
You can get all the relations of a class with:
$relations = Doctrine_Core::getTable('<CLASS_NAME>')->getRelations();
foreach($relations as $relation)
echo $relation->getClass();
See Doctrine_Relation_Association and Doctrine_Relation for more information.
you can use also:
$relations = Doctrine_Core::getTable('Student')->findAll();
foreach($relations as $relation)
echo $relation->getTests();