Search in sources :

Example 1 with ComponentFinder

use of org.sonar.server.component.ComponentFinder in project sonarqube by SonarSource.

the class CreateActionTest method setUp.

@Before
public void setUp() {
    ws = new WsTester(new CustomMeasuresWs(new CreateAction(dbClient, userSession, System2.INSTANCE, new CustomMeasureValidator(newFullTypeValidations()), new CustomMeasureJsonWriter(new UserJsonWriter(userSession)), new ComponentFinder(dbClient))));
    db.getDbClient().userDao().insert(dbSession, new UserDto().setLogin("login").setName("Login").setEmail("login@login.com").setActive(true));
    dbSession.commit();
    userSession.logIn("login").addProjectUuidPermissions(UserRole.ADMIN, DEFAULT_PROJECT_UUID);
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) WsTester(org.sonar.server.ws.WsTester) UserJsonWriter(org.sonar.server.user.ws.UserJsonWriter) UserDto(org.sonar.db.user.UserDto) Before(org.junit.Before)

Example 2 with ComponentFinder

use of org.sonar.server.component.ComponentFinder in project sonarqube by SonarSource.

the class AddActionTest method setUp.

@Before
public void setUp() {
    NotificationDispatcherMetadata metadata1 = NotificationDispatcherMetadata.create(NOTIF_MY_NEW_ISSUES).setProperty(GLOBAL_NOTIFICATION, "true").setProperty(PER_PROJECT_NOTIFICATION, "true");
    NotificationDispatcherMetadata metadata2 = NotificationDispatcherMetadata.create(NOTIF_NEW_ISSUES).setProperty(GLOBAL_NOTIFICATION, "true");
    NotificationDispatcherMetadata metadata3 = NotificationDispatcherMetadata.create(NOTIF_NEW_QUALITY_GATE_STATUS).setProperty(GLOBAL_NOTIFICATION, "true").setProperty(PER_PROJECT_NOTIFICATION, "true");
    notificationCenter = new NotificationCenter(new NotificationDispatcherMetadata[] { metadata1, metadata2, metadata3 }, new NotificationChannel[] { emailChannel, twitterChannel, defaultChannel });
    underTest = new AddAction(notificationCenter, new NotificationUpdater(userSession, dbClient), dbClient, new ComponentFinder(dbClient), userSession);
    ws = new WsActionTester(underTest);
}
Also used : NotificationChannel(org.sonar.api.notifications.NotificationChannel) ComponentFinder(org.sonar.server.component.ComponentFinder) NotificationCenter(org.sonar.server.notification.NotificationCenter) NotificationDispatcherMetadata(org.sonar.server.notification.NotificationDispatcherMetadata) NotificationUpdater(org.sonar.server.notification.NotificationUpdater) WsActionTester(org.sonar.server.ws.WsActionTester) Before(org.junit.Before)

Example 3 with ComponentFinder

use of org.sonar.server.component.ComponentFinder in project sonarqube by SonarSource.

the class DeleteTemplateActionTest method setUp.

@Before
public void setUp() throws Exception {
    GroupWsSupport groupWsSupport = new GroupWsSupport(dbClient, TestDefaultOrganizationProvider.from(db));
    this.underTestWithoutViews = new WsActionTester(new DeleteTemplateAction(dbClient, userSession, new PermissionWsSupport(dbClient, new ComponentFinder(dbClient), groupWsSupport, resourceTypes), defaultTemplatesResolver));
    this.underTestWithViews = new WsActionTester(new DeleteTemplateAction(dbClient, userSession, new PermissionWsSupport(dbClient, new ComponentFinder(dbClient), groupWsSupport, resourceTypesWithViews), defaultTemplatesResolverWithViews));
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) PermissionWsSupport(org.sonar.server.permission.ws.PermissionWsSupport) GroupWsSupport(org.sonar.server.usergroups.ws.GroupWsSupport) WsActionTester(org.sonar.server.ws.WsActionTester) Before(org.junit.Before)

Example 4 with ComponentFinder

use of org.sonar.server.component.ComponentFinder in project sonarqube by SonarSource.

the class SelectActionTest method setUp.

@Before
public void setUp() {
    ComponentFinder componentFinder = new ComponentFinder(dbClient);
    underTest = new SelectAction(dbClient, userSession, componentFinder);
    ws = new WsActionTester(underTest);
    project = db.components().insertProject();
    gate = insertQualityGate();
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) WsActionTester(org.sonar.server.ws.WsActionTester) Before(org.junit.Before)

Example 5 with ComponentFinder

use of org.sonar.server.component.ComponentFinder in project sonarqube by SonarSource.

the class DeselectActionTest method setUp.

@Before
public void setUp() {
    ComponentFinder componentFinder = new ComponentFinder(dbClient);
    underTest = new DeselectAction(qualityGates, dbClient, componentFinder);
    ws = new WsActionTester(underTest);
    project = db.components().insertProject();
    gate = insertQualityGate();
}
Also used : ComponentFinder(org.sonar.server.component.ComponentFinder) WsActionTester(org.sonar.server.ws.WsActionTester) Before(org.junit.Before)

Aggregations

ComponentFinder (org.sonar.server.component.ComponentFinder)24 Before (org.junit.Before)23 WsActionTester (org.sonar.server.ws.WsActionTester)13 WsTester (org.sonar.server.ws.WsTester)11 NotificationChannel (org.sonar.api.notifications.NotificationChannel)2 UserDto (org.sonar.db.user.UserDto)2 NotificationCenter (org.sonar.server.notification.NotificationCenter)2 NotificationDispatcherMetadata (org.sonar.server.notification.NotificationDispatcherMetadata)2 NotificationUpdater (org.sonar.server.notification.NotificationUpdater)2 UserJsonWriter (org.sonar.server.user.ws.UserJsonWriter)2 Matchers.anyString (org.mockito.Matchers.anyString)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 I18n (org.sonar.api.i18n.I18n)1 Languages (org.sonar.api.resources.Languages)1 Page (org.sonar.api.web.page.Page)1 PluginRepository (org.sonar.core.platform.PluginRepository)1 DbClient (org.sonar.db.DbClient)1 ComponentDao (org.sonar.db.component.ComponentDao)1 IssueIndex (org.sonar.server.issue.index.IssueIndex)1 AuthorizationTypeSupport (org.sonar.server.permission.index.AuthorizationTypeSupport)1