Skip to content

Commit

Permalink
NO-JIRA removing duplicated method
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-jarocki-sonarsource authored and sonartech committed Jan 11, 2023
1 parent edf6bb1 commit 2713bc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,6 @@ public ComponentDto create(DbSession dbSession, NewComponent newComponent, @Null
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ public void create_shouldFail_whenCreatingProjectWithExistingKeyButDifferentCase
}

@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();
Expand Down

0 comments on commit 2713bc0

Please sign in to comment.