Search in sources :

Example 1 with BuildProblemResponsibilityEntry

use of jetbrains.buildServer.responsibility.BuildProblemResponsibilityEntry in project teamcity-rest by JetBrains.

the class InvestigationFinderTest method testProblemInvestigationModel.

@Test
public void testProblemInvestigationModel() throws Exception {
    createFailingBuild();
    final BuildProblemInfoImpl buildProblem = new BuildProblemInfoImpl(myProject.getProjectId(), getProblemId(PROBLEM_IDENTITY));
    myFixture.getResponsibilityFacadeEx().setBuildProblemResponsibility(buildProblem, myProject.getProjectId(), createRespEntry(ResponsibilityEntry.State.TAKEN, myUser));
    final BuildProblemResponsibilityEntry buildProblemResponsibility = myFixture.getResponsibilityFacadeEx().findBuildProblemResponsibility(buildProblem, myProject.getProjectId());
    assert buildProblemResponsibility != null;
    final PagedSearchResult<InvestigationWrapper> ivestigationWrappers = myInvestigationFinder.getItems((String) null);
    final Investigations investigations = new Investigations(ivestigationWrappers.myEntries, null, Fields.LONG, getBeanContext(myServer));
    assertEquals(1, investigations.count.longValue());
    final Investigation investigation = investigations.items.get(0);
    assertEquals("assignmentProject:(id:" + myProject.getExternalId() + "),problem:(id:" + buildProblemResponsibility.getBuildProblemInfo().getId() + ")", investigation.id);
    assertEquals("TAKEN", investigation.state);
    assertEquals((Long) myUser.getId(), investigation.assignee.getId());
    assertEquals("The comment", investigation.assignment.text);
    assertEquals(null, investigation.target.anyProblem);
    assertEquals(null, investigation.target.tests);
    assertEquals(PROBLEM_IDENTITY, investigation.target.problems.items.get(0).identity);
    assertEquals(myProject.getExternalId(), investigation.scope.project.id);
}
Also used : InvestigationWrapper(jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper) BuildProblemResponsibilityEntry(jetbrains.buildServer.responsibility.BuildProblemResponsibilityEntry) Investigation(jetbrains.buildServer.server.rest.model.buildType.Investigation) BuildProblemInfoImpl(jetbrains.buildServer.serverSide.impl.problems.BuildProblemInfoImpl) Investigations(jetbrains.buildServer.server.rest.model.buildType.Investigations) Test(org.testng.annotations.Test)

Example 2 with BuildProblemResponsibilityEntry

use of jetbrains.buildServer.responsibility.BuildProblemResponsibilityEntry in project teamcity-rest by JetBrains.

the class ProblemWrapper method getInvestigations.

@NotNull
public List<InvestigationWrapper> getInvestigations() {
    if (investigations == null) {
        final String rootProjectId = myServiceLocator.getSingletonService(ProjectFinder.class).getRootProject().getProjectId();
        final List<BuildProblemResponsibilityEntry> responsibilities = myServiceLocator.getSingletonService(BuildProblemResponsibilityFacade.class).findBuildProblemResponsibilities(getBuildProblemInfo(id, rootProjectId), rootProjectId);
        final Set<InvestigationWrapper> investigationsSet = new TreeSet<InvestigationWrapper>();
        for (BuildProblemResponsibilityEntry responsibility : responsibilities) {
            investigationsSet.add(new InvestigationWrapper(responsibility));
        }
        investigations = new ArrayList<InvestigationWrapper>(investigationsSet);
    }
    return investigations;
}
Also used : InvestigationWrapper(jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper) TreeSet(java.util.TreeSet) BuildProblemResponsibilityEntry(jetbrains.buildServer.responsibility.BuildProblemResponsibilityEntry) BuildProblemResponsibilityFacade(jetbrains.buildServer.responsibility.BuildProblemResponsibilityFacade) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

BuildProblemResponsibilityEntry (jetbrains.buildServer.responsibility.BuildProblemResponsibilityEntry)2 InvestigationWrapper (jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper)2 TreeSet (java.util.TreeSet)1 BuildProblemResponsibilityFacade (jetbrains.buildServer.responsibility.BuildProblemResponsibilityFacade)1 Investigation (jetbrains.buildServer.server.rest.model.buildType.Investigation)1 Investigations (jetbrains.buildServer.server.rest.model.buildType.Investigations)1 BuildProblemInfoImpl (jetbrains.buildServer.serverSide.impl.problems.BuildProblemInfoImpl)1 NotNull (org.jetbrains.annotations.NotNull)1 Test (org.testng.annotations.Test)1