Search in sources :

Example 1 with ProblemScope

use of jetbrains.buildServer.server.rest.model.buildType.ProblemScope in project teamcity-rest by JetBrains.

the class InvestigationRequestTest method testAssignInvestigation.

@Test
void testAssignInvestigation() throws Throwable {
    final SUser user2 = createUser("user2");
    Investigation investigation = new Investigation();
    investigation.state = "taken";
    investigation.assignee = new User();
    investigation.assignee.setId(user2.getId());
    investigation.assignment = new Comment();
    investigation.assignment.text = "comment here";
    investigation.scope = new ProblemScope();
    investigation.scope.project = new Project();
    investigation.scope.project.id = myProject.getExternalId();
    investigation.target = new ProblemTarget();
    investigation.target.tests = new Tests();
    jetbrains.buildServer.server.rest.model.problem.Test test = new jetbrains.buildServer.server.rest.model.problem.Test();
    test.name = "testname";
    investigation.target.tests.items = Collections.singletonList(test);
    investigation.resolution = new Resolution();
    investigation.resolution.type = Resolution.ResolutionType.manually;
    investigation.resolution.time = "20900512T163700";
    assertEmpty(myInvestigationFinder.getItems(null).myEntries);
    createBuildWithFailedTest("testname");
    Investigation result = myRequest.createInstance(investigation, "$long");
    assertEquals("testname", result.target.tests.items.get(0).name);
    List<InvestigationWrapper> currentInvestigations = myInvestigationFinder.getItems(null).myEntries;
    assertEquals(1, currentInvestigations.size());
    InvestigationWrapper investigationWrapper = currentInvestigations.get(0);
    assertEquals(ResponsibilityEntry.State.TAKEN, investigationWrapper.getState());
    assertEquals(user2.getId(), investigationWrapper.getResponsibleUser().getId());
    assertEquals("comment here", investigationWrapper.getComment());
    assertEquals(null, investigationWrapper.getProblemRE());
    assertEquals(myProject.getProjectId(), investigationWrapper.getTestRE().getProjectId());
    assertEquals("testname", investigationWrapper.getTestRE().getTestName().getAsString());
    assertEquals(myProject.getProjectId(), investigationWrapper.getAssignmentProject().getProjectId());
    myRequest.deleteInstance(investigationWrapper.getId());
    assertEmpty(myInvestigationFinder.getItems(null).myEntries);
}
Also used : Comment(jetbrains.buildServer.server.rest.model.Comment) InvestigationWrapper(jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper) User(jetbrains.buildServer.server.rest.model.user.User) SUser(jetbrains.buildServer.users.SUser) ProblemTarget(jetbrains.buildServer.server.rest.model.buildType.ProblemTarget) SUser(jetbrains.buildServer.users.SUser) Tests(jetbrains.buildServer.server.rest.model.problem.Tests) ProblemScope(jetbrains.buildServer.server.rest.model.buildType.ProblemScope) Project(jetbrains.buildServer.server.rest.model.project.Project) BaseFinderTest(jetbrains.buildServer.server.rest.data.BaseFinderTest) Test(org.testng.annotations.Test) Investigation(jetbrains.buildServer.server.rest.model.buildType.Investigation) Resolution(jetbrains.buildServer.server.rest.model.problem.Resolution) BaseFinderTest(jetbrains.buildServer.server.rest.data.BaseFinderTest) Test(org.testng.annotations.Test)

Aggregations

BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)1 InvestigationWrapper (jetbrains.buildServer.server.rest.data.investigations.InvestigationWrapper)1 Comment (jetbrains.buildServer.server.rest.model.Comment)1 Investigation (jetbrains.buildServer.server.rest.model.buildType.Investigation)1 ProblemScope (jetbrains.buildServer.server.rest.model.buildType.ProblemScope)1 ProblemTarget (jetbrains.buildServer.server.rest.model.buildType.ProblemTarget)1 Resolution (jetbrains.buildServer.server.rest.model.problem.Resolution)1 Tests (jetbrains.buildServer.server.rest.model.problem.Tests)1 Project (jetbrains.buildServer.server.rest.model.project.Project)1 User (jetbrains.buildServer.server.rest.model.user.User)1 SUser (jetbrains.buildServer.users.SUser)1 Test (org.testng.annotations.Test)1