Package org.sonar.core.resource

Examples of org.sonar.core.resource.ResourceDto


  }

  @Test
  public void delete() {
    when(actionPlanDao.findByKey("ABCD")).thenReturn(new ActionPlanDto().setKey("ABCD").setProjectKey_unit_test_only(projectKey));
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));
    actionPlanService.delete("ABCD", projectAdministratorUserSession);
    verify(actionPlanDao).delete("ABCD");
  }
View Full Code Here


  }

  @Test
  public void unplan_all_linked_issues_when_deleting_an_action_plan() {
    when(actionPlanDao.findByKey("ABCD")).thenReturn(new ActionPlanDto().setKey("ABCD").setProjectKey_unit_test_only(projectKey));
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));

    IssueDto issueDto = new IssueDto().setId(100L).setStatus(Issue.STATUS_OPEN).setRuleKey("squid", "s100");
    when(issueDao.findByActionPlan(session, "ABCD")).thenReturn(newArrayList(issueDto));
    when(issueUpdater.plan(any(DefaultIssue.class), eq((ActionPlan) null), any(IssueChangeContext.class))).thenReturn(true);
View Full Code Here

  }

  @Test
  public void find_by_key() {
    when(actionPlanDao.findByKey("ABCD")).thenReturn(new ActionPlanDto().setKey("ABCD").setProjectKey_unit_test_only(projectKey));
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));

    ActionPlan result = actionPlanService.findByKey("ABCD", projectUserSession);
    assertThat(result).isNotNull();
    assertThat(result.key()).isEqualTo("ABCD");
  }
View Full Code Here

    assertThat(results.iterator().next().key()).isEqualTo("ABCD");
  }

  @Test
  public void find_open_by_project_key() {
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));
    when(actionPlanDao.findOpenByProjectId(1l)).thenReturn(newArrayList(new ActionPlanDto().setKey("ABCD")));
    Collection<ActionPlan> results = actionPlanService.findOpenByProjectKey(projectKey, projectUserSession);
    assertThat(results).hasSize(1);
    assertThat(results.iterator().next().key()).isEqualTo("ABCD");
  }
View Full Code Here

    assertThat(results.iterator().next().key()).isEqualTo("ABCD");
  }

  @Test
  public void find_open_by_project_key_required_user_role() {
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));
    when(actionPlanDao.findOpenByProjectId(1l)).thenReturn(newArrayList(new ActionPlanDto().setKey("ABCD")));

    try {
      actionPlanService.findOpenByProjectKey(projectKey, unauthorizedUserSession);
      Fail.fail();
View Full Code Here

    actionPlanService.findOpenByProjectKey("<Unkown>", projectUserSession);
  }

  @Test
  public void find_action_plan_stats() {
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setId(1L).setKey(projectKey));
    when(actionPlanStatsDao.findByProjectId(1L)).thenReturn(newArrayList(new ActionPlanStatsDto()));

    Collection<ActionPlanStats> results = actionPlanService.findActionPlanStats(projectKey, projectUserSession);
    assertThat(results).hasSize(1);
  }
View Full Code Here

        File dbFile = new File(new File(dryRunCacheLocation, "123"), (String) args[2] + ".h2.db");
        FileUtils.write(dbFile, "fake db content");
        return dbFile;
      }
    });
    when(resourceDao.getRootProjectByComponentId(123L)).thenReturn(new ResourceDto().setId(123L));
    byte[] dbContent = dryRunCache.getDatabaseForPreview(123L);
    assertThat(new String(dbContent)).isEqualTo("fake db content");

    dbContent = dryRunCache.getDatabaseForPreview(123L);
    assertThat(new String(dbContent)).isEqualTo("fake db content");
View Full Code Here

          File dbFile = new File(new File(dryRunCacheLocation, "123"), (String) args[2] + ".h2.db");
          FileUtils.write(dbFile, "fake db content 2");
          return dbFile;
        }
      });
    when(resourceDao.getRootProjectByComponentId(123L)).thenReturn(new ResourceDto().setId(123L));

    byte[] dbContent = dryRunCache.getDatabaseForPreview(123L);
    assertThat(new String(dbContent)).isEqualTo("fake db content 1");

    // Emulate invalidation of cache
View Full Code Here

    verify(session).commit();
  }

  @Test
  public void test_report_resource_modification() {
    when(resourceDao.getRootProjectByComponentKey("foo")).thenReturn(new ResourceDto().setId(456L));

    dryRunCache.reportResourceModification("foo");

    verify(propertiesDao).setProperty(
      new PropertyDto()
View Full Code Here

TOP

Related Classes of org.sonar.core.resource.ResourceDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.