return componentDto;
}
- /**
- * - Create component
- * - Apply default permission template
- * - Add component to favorite if the component has the 'Project Creators' permission
- * - Index component in es indexes
- */
- public ComponentDto createApplicationOrPortfolio(DbSession dbSession, NewComponent newComponent, @Nullable String userUuid,
- @Nullable String userLogin, @Nullable String mainBranchName) {
- ComponentDto componentDto = createWithoutCommit(dbSession, newComponent, userUuid, userLogin, mainBranchName, c -> {});
- commitAndIndex(dbSession, componentDto);
- return componentDto;
- }
-
public void commitAndIndex(DbSession dbSession, ComponentDto componentDto) {
projectIndexers.commitAndIndexComponents(dbSession, singletonList(componentDto), Cause.PROJECT_CREATION);
}
}
@Test
- public void createApplicationOrPortfolio_createsComponentWithMasterBranchName() {
+ public void create_createsComponentWithMasterBranchName() {
String componentNameAndKey = "createApplicationOrPortfolio";
- ComponentDto app = underTest.createApplicationOrPortfolio(db.getSession(),
- NewComponent.newComponentBuilder().setName(componentNameAndKey).setKey(componentNameAndKey).setQualifier("APP").build(), null, null, null);
+ ComponentDto app = underTest.create(db.getSession(), NewComponent.newComponentBuilder().setName(componentNameAndKey)
+ .setKey(componentNameAndKey).setQualifier("APP").build(), null, null, null);
Optional<BranchDto> branch = db.getDbClient().branchDao().selectByUuid(db.getSession(), app.branchUuid());
assertThat(branch).isPresent();