Examples of ResourceDto


Examples of org.sonar.core.resource.ResourceDto

  @Test(expected=BadRequestException.class)
  public void should_throw_if_malformed_key_in_update() {
    final long componentId = 1234l;
    final String newKey = "new/key";
    final String newName = "newName";
    ResourceDto resource = mock(ResourceDto.class);
    when(resourceDao.getResource(componentId)).thenReturn(resource);
    service.updateComponent(componentId, newKey, newName);
  }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

  PermissionFinder finder;

  @Before
  public void setUp() throws Exception {
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setId(100L).setName("org.sample.Sample"));
    finder = new PermissionFinder(permissionDao, resourceDao, permissionTemplateDao);
  }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

  InternalRubyIssueService service;

  @Before
  public void setUp() {
    ResourceDto project = new ResourceDto().setKey("org.sonar.Sample");
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(project);
    service = new InternalRubyIssueService(issueService, issueQueryService, commentService, changelogService, actionPlanService, resourceDao, actionService,
      issueFilterService, issueBulkChangeService);
  }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

    UserSession.get().checkLoggedIn();

    DbSession session = dbClient.openSession(false);
    try {
      ComponentDto component = dbClient.componentDao().getByKey(session, componentKey);
      ResourceDto provisioned = resourceDao.selectProvisionedProject(session, componentKey);
      if (provisioned == null) {
        checkProjectAdminPermission(componentKey);
      } else {
        UserSession.get().checkGlobalPermission(GlobalPermissions.PROVISIONING);
      }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

    this.issueUpdater = issueUpdater;
    this.issueStorage = issueStorage;
  }

  public ActionPlan create(ActionPlan actionPlan, UserSession userSession) {
    ResourceDto project = findProject(actionPlan.projectKey());
    checkUserIsProjectAdministrator(project.getKey(), userSession);
    actionPlanDao.save(ActionPlanDto.toActionDto(actionPlan, project.getId()));
    return actionPlan;
  }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

    actionPlanDao.save(ActionPlanDto.toActionDto(actionPlan, project.getId()));
    return actionPlan;
  }

  public ActionPlan update(ActionPlan actionPlan, UserSession userSession) {
    ResourceDto project = findProject(actionPlan.projectKey());
    checkUserIsProjectAdministrator(project.getKey(), userSession);
    actionPlanDao.update(ActionPlanDto.toActionDto(actionPlan, project.getId()));
    return actionPlan;
  }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

    List<ActionPlanDto> actionPlanDtos = actionPlanDao.findByKeys(keys);
    return toActionPlans(actionPlanDtos);
  }

  public Collection<ActionPlan> findOpenByProjectKey(String projectKey, UserSession userSession) {
    ResourceDto project = findProject(projectKey);
    checkUserCanAccessProject(project.getKey(), userSession);

    List<ActionPlanDto> dtos = actionPlanDao.findOpenByProjectId(project.getId());
    List<ActionPlan> plans = toActionPlans(dtos);
    Collections.sort(plans, new ActionPlanDeadlineComparator());
    return plans;
  }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

    Collections.sort(plans, new ActionPlanDeadlineComparator());
    return plans;
  }

  public List<ActionPlanStats> findActionPlanStats(String projectKey, UserSession userSession) {
    ResourceDto project = findProject(projectKey);
    checkUserCanAccessProject(project.getKey(), userSession);

    List<ActionPlanStatsDto> actionPlanStatsDtos = actionPlanStatsDao.findByProjectId(project.getId());
    List<ActionPlanStats> actionPlanStats = newArrayList(Iterables.transform(actionPlanStatsDtos, new Function<ActionPlanStatsDto, ActionPlanStats>() {
      @Override
      public ActionPlanStats apply(ActionPlanStatsDto actionPlanStatsDto) {
        return actionPlanStatsDto.toActionPlanStat();
      }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

    }
    return actionPlanDto;
  }

  private ResourceDto findProject(String projectKey) {
    ResourceDto resourceDto = resourceDao.getResource(ResourceQuery.create().setKey(projectKey));
    if (resourceDto == null) {
      throw new NotFoundException("Project " + projectKey + " does not exists.");
    }
    return resourceDto;
  }
View Full Code Here

Examples of org.sonar.core.resource.ResourceDto

  public void get_source_as_html() throws Exception {
    String componentKey = "org.sonar.sample:Sample";
    String source = "line 1\nline 2\nline 3\n";
    String htmlSource = "<span>line 1</span>\n<span>line 2</span>\n";

    when(resourceDao.getResource(any(ResourceQuery.class), eq(session))).thenReturn(new ResourceDto().setKey(componentKey).setLanguage("java"));
    when(snapshotSourceDao.selectSnapshotSourceByComponentKey(componentKey, session)).thenReturn(source);
    when(codeColorizers.toHtml(source, "java")).thenReturn(htmlSource);

    List<String> result = sourceDecorator.getSourceAsHtml(componentKey);
    assertThat(result).containsExactly("<span>line 1</span>", "<span>line 2</span>", "");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.