testCompile 'org.subethamail:subethasmtp'
testCompile testFixtures(project(':server:sonar-server-common'))
testCompile testFixtures(project(':server:sonar-webserver-auth'))
- testCompile project(path: ":server:sonar-webserver-es", configuration: "tests")
+ testCompile testFixtures(project(':server:sonar-webserver-es'))
testCompile testFixtures(project(':server:sonar-webserver-ws'))
testCompile project(':sonar-testing-harness')
}
}
-configurations {
- tests
-
- testCompile.extendsFrom tests
-}
-
dependencies {
// please keep the list grouped by configuration and ordered by name
testCompile 'com.tngtech.java:junit-dataprovider'
testCompile 'org.mockito:mockito-core'
testCompile testFixtures(project(':server:sonar-webserver-auth'))
- testCompile testFixtures(project(':server:sonar-server-common'))
testCompile project(':sonar-testing-harness')
-}
-
-task testJar(type: Jar) {
- classifier = 'tests'
- from sourceSets.test.output
-}
-
-artifacts {
- tests testJar
+
+ testFixturesApi testFixtures(project(':server:sonar-server-common'))
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.permission.index;
-
-import org.sonar.api.config.internal.MapSettings;
-import org.sonar.server.es.Index;
-import org.sonar.server.es.IndexDefinition;
-import org.sonar.server.es.IndexType;
-import org.sonar.server.es.newindex.NewAuthorizedIndex;
-
-import static org.sonar.server.es.newindex.SettingsConfiguration.MANUAL_REFRESH_INTERVAL;
-import static org.sonar.server.es.newindex.SettingsConfiguration.newBuilder;
-
-public class FooIndexDefinition implements IndexDefinition {
-
- public static final Index DESCRIPTOR = Index.withRelations("foos");
- public static final String FOO_TYPE = "foo";
- public static final IndexType.IndexMainType TYPE_AUTHORIZATION = IndexType.main(DESCRIPTOR, IndexAuthorizationConstants.TYPE_AUTHORIZATION);
- public static final IndexType.IndexRelationType TYPE_FOO = IndexType.relation(TYPE_AUTHORIZATION, FOO_TYPE);
- public static final String FIELD_NAME = "name";
- public static final String FIELD_PROJECT_UUID = "projectUuid";
-
- @Override
- public void define(IndexDefinitionContext context) {
- NewAuthorizedIndex newIndex = context.createWithAuthorization(
- DESCRIPTOR,
- newBuilder(new MapSettings().asConfig())
- .setRefreshInterval(MANUAL_REFRESH_INTERVAL)
- .build());
-
- newIndex.createTypeMapping(TYPE_FOO)
- .keywordFieldBuilder(FIELD_NAME).build()
- .keywordFieldBuilder(FIELD_PROJECT_UUID).build();
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.permission.index;
-
-import java.util.List;
-import java.util.stream.Stream;
-import org.sonar.db.component.ComponentDto;
-import org.sonar.db.user.GroupDto;
-import org.sonar.db.user.UserDto;
-import org.sonar.server.es.EsTester;
-
-import static java.util.Arrays.stream;
-import static java.util.stream.Collectors.toList;
-
-public class PermissionIndexerTester {
-
- private final PermissionIndexer permissionIndexer;
-
- public PermissionIndexerTester(EsTester esTester, NeedAuthorizationIndexer indexer, NeedAuthorizationIndexer... others) {
- NeedAuthorizationIndexer[] indexers = Stream.concat(Stream.of(indexer), stream(others)).toArray(NeedAuthorizationIndexer[]::new);
- this.permissionIndexer = new PermissionIndexer(null, esTester.client(), indexers);
- }
-
- public PermissionIndexerTester allowOnlyAnyone(ComponentDto... projects) {
- return allow(stream(projects).map(project -> new IndexPermissions(project.uuid(), project.qualifier()).allowAnyone()).collect(toList()));
- }
-
- public PermissionIndexerTester allowOnlyUser(ComponentDto project, UserDto user) {
- IndexPermissions dto = new IndexPermissions(project.uuid(), project.qualifier())
- .addUserId(user.getId());
- return allow(dto);
- }
-
- public PermissionIndexerTester allowOnlyGroup(ComponentDto project, GroupDto group) {
- IndexPermissions dto = new IndexPermissions(project.uuid(), project.qualifier())
- .addGroupId(group.getId());
- return allow(dto);
- }
-
- public PermissionIndexerTester allow(IndexPermissions... indexPermissions) {
- return allow(stream(indexPermissions).collect(toList()));
- }
-
- public PermissionIndexerTester allow(List<IndexPermissions> indexPermissions) {
- permissionIndexer.index(indexPermissions);
- return this;
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.permission.index;
+
+import org.sonar.api.config.internal.MapSettings;
+import org.sonar.server.es.Index;
+import org.sonar.server.es.IndexDefinition;
+import org.sonar.server.es.IndexType;
+import org.sonar.server.es.newindex.NewAuthorizedIndex;
+
+import static org.sonar.server.es.newindex.SettingsConfiguration.MANUAL_REFRESH_INTERVAL;
+import static org.sonar.server.es.newindex.SettingsConfiguration.newBuilder;
+
+public class FooIndexDefinition implements IndexDefinition {
+
+ public static final Index DESCRIPTOR = Index.withRelations("foos");
+ public static final String FOO_TYPE = "foo";
+ public static final IndexType.IndexMainType TYPE_AUTHORIZATION = IndexType.main(DESCRIPTOR, IndexAuthorizationConstants.TYPE_AUTHORIZATION);
+ public static final IndexType.IndexRelationType TYPE_FOO = IndexType.relation(TYPE_AUTHORIZATION, FOO_TYPE);
+ public static final String FIELD_NAME = "name";
+ public static final String FIELD_PROJECT_UUID = "projectUuid";
+
+ @Override
+ public void define(IndexDefinitionContext context) {
+ NewAuthorizedIndex newIndex = context.createWithAuthorization(
+ DESCRIPTOR,
+ newBuilder(new MapSettings().asConfig())
+ .setRefreshInterval(MANUAL_REFRESH_INTERVAL)
+ .build());
+
+ newIndex.createTypeMapping(TYPE_FOO)
+ .keywordFieldBuilder(FIELD_NAME).build()
+ .keywordFieldBuilder(FIELD_PROJECT_UUID).build();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.permission.index;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.sonar.db.component.ComponentDto;
+import org.sonar.db.user.GroupDto;
+import org.sonar.db.user.UserDto;
+import org.sonar.server.es.EsTester;
+
+import static java.util.Arrays.stream;
+import static java.util.stream.Collectors.toList;
+
+public class PermissionIndexerTester {
+
+ private final PermissionIndexer permissionIndexer;
+
+ public PermissionIndexerTester(EsTester esTester, NeedAuthorizationIndexer indexer, NeedAuthorizationIndexer... others) {
+ NeedAuthorizationIndexer[] indexers = Stream.concat(Stream.of(indexer), stream(others)).toArray(NeedAuthorizationIndexer[]::new);
+ this.permissionIndexer = new PermissionIndexer(null, esTester.client(), indexers);
+ }
+
+ public PermissionIndexerTester allowOnlyAnyone(ComponentDto... projects) {
+ return allow(stream(projects).map(project -> new IndexPermissions(project.uuid(), project.qualifier()).allowAnyone()).collect(toList()));
+ }
+
+ public PermissionIndexerTester allowOnlyUser(ComponentDto project, UserDto user) {
+ IndexPermissions dto = new IndexPermissions(project.uuid(), project.qualifier())
+ .addUserId(user.getId());
+ return allow(dto);
+ }
+
+ public PermissionIndexerTester allowOnlyGroup(ComponentDto project, GroupDto group) {
+ IndexPermissions dto = new IndexPermissions(project.uuid(), project.qualifier())
+ .addGroupId(group.getId());
+ return allow(dto);
+ }
+
+ public PermissionIndexerTester allow(IndexPermissions... indexPermissions) {
+ return allow(stream(indexPermissions).collect(toList()));
+ }
+
+ public PermissionIndexerTester allow(List<IndexPermissions> indexPermissions) {
+ permissionIndexer.index(indexPermissions);
+ return this;
+ }
+}
testCompile 'org.mockito:mockito-core'
testCompile testFixtures(project(':server:sonar-server-common'))
testCompile testFixtures(project(':server:sonar-webserver-auth'))
- testCompile project(path: ":server:sonar-webserver-es", configuration: "tests")
+ testCompile testFixtures(project(':server:sonar-webserver-es'))
testCompile testFixtures(project(':server:sonar-webserver-ws'))
testCompile project(':sonar-testing-harness')
}
testCompile 'org.eclipse.jetty:jetty-servlet'
testCompile testFixtures(project(':server:sonar-server-common'))
testCompile testFixtures(project(':server:sonar-webserver-auth'))
- testCompile project(path: ":server:sonar-webserver-es", configuration: "tests")
+ testCompile testFixtures(project(':server:sonar-webserver-es'))
testCompile project(':sonar-testing-harness')
}