Search in sources :

Example 6 with InvestigationWrapper

use of jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper in project teamcity-rest by JetBrains.

the class InvestigationFinderTest method testTestInvestigationModel.

@Test
public void testTestInvestigationModel() throws Exception {
    createFailingBuild();
    final TestName testName = new TestName(FAIL_TEST2_NAME);
    myFixture.getResponsibilityFacadeEx().setTestNameResponsibility(testName, myProject.getProjectId(), createRespEntry(ResponsibilityEntry.State.TAKEN, myUser));
    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);
    final TestName2Index testName2Index = myFixture.getSingletonService(TestName2Index.class);
    assertEquals("assignmentProject:(id:" + myProject.getExternalId() + "),test:(id:" + testName2Index.findTestNameId(testName) + ")", 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.problems);
    assertEquals(FAIL_TEST2_NAME, investigation.target.tests.items.get(0).name);
    assertEquals(null, investigation.scope.buildTypes);
    assertEquals(myProject.getExternalId(), investigation.scope.project.id);
}
Also used : TestName(jetbrains.buildServer.tests.TestName) InvestigationWrapper(jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper) Investigation(jetbrains.buildServer.server.rest.model.buildType.Investigation) TestName2Index(jetbrains.buildServer.serverSide.TestName2Index) Investigations(jetbrains.buildServer.server.rest.model.buildType.Investigations) Test(org.testng.annotations.Test)

Example 7 with InvestigationWrapper

use of jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper 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 8 with InvestigationWrapper

use of jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper in project teamcity-rest by JetBrains.

the class InvestigationFinderTest method testBuildTypeInvestigationModel.

@Test
public void testBuildTypeInvestigationModel() throws Exception {
    createFailingBuild();
    myFixture.getResponsibilityFacadeEx().setBuildTypeResponsibility(myBuildType, createRespEntry(ResponsibilityEntry.State.TAKEN, myUser));
    final PagedSearchResult<InvestigationWrapper> ivestigationWrappers = myInvestigationFinder.getItems((String) null);
    final Investigations investigations = new Investigations(ivestigationWrappers.myEntries, null, Fields.ALL_NESTED, getBeanContext(myServer));
    assertEquals(1, investigations.count.longValue());
    final Investigation investigation = investigations.items.get(0);
    assertEquals("buildType:(id:" + myBuildType.getExternalId() + ")", investigation.id);
    assertEquals("TAKEN", investigation.state);
    assertEquals((Long) myUser.getId(), investigation.assignee.getId());
    assertEquals("The comment", investigation.assignment.text);
    assertEquals(Boolean.TRUE, investigation.target.anyProblem);
    assertEquals(null, investigation.target.problems);
    assertEquals(null, investigation.target.tests);
    assertEquals(myBuildType.getExternalId(), investigation.scope.buildTypes.buildTypes.get(0).getId());
    assertEquals(null, investigation.scope.project);
}
Also used : InvestigationWrapper(jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper) Investigation(jetbrains.buildServer.server.rest.model.buildType.Investigation) Investigations(jetbrains.buildServer.server.rest.model.buildType.Investigations) Test(org.testng.annotations.Test)

Example 9 with InvestigationWrapper

use of jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper 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

InvestigationWrapper (jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper)9 Test (org.testng.annotations.Test)5 Investigation (jetbrains.buildServer.server.rest.model.buildType.Investigation)4 Investigations (jetbrains.buildServer.server.rest.model.buildType.Investigations)3 ApiOperation (io.swagger.annotations.ApiOperation)2 BuildProblemResponsibilityEntry (jetbrains.buildServer.responsibility.BuildProblemResponsibilityEntry)2 Comment (jetbrains.buildServer.server.rest.model.Comment)2 Resolution (jetbrains.buildServer.server.rest.model.problem.Resolution)2 User (jetbrains.buildServer.server.rest.model.user.User)2 NotNull (org.jetbrains.annotations.NotNull)2 Api (io.swagger.annotations.Api)1 ApiModelProperty (io.swagger.annotations.ApiModelProperty)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1 TreeSet (java.util.TreeSet)1 Collectors (java.util.stream.Collectors)1 XmlAttribute (javax.xml.bind.annotation.XmlAttribute)1 XmlElement (javax.xml.bind.annotation.XmlElement)1 XmlRootElement (javax.xml.bind.annotation.XmlRootElement)1