this.generateComponentPrefix(qualifier);
}
+
+ public ComponentNewValue(String componentUuid, String name, boolean isPrivate, String qualifier) {
+ this.componentUuid = componentUuid;
+ this.componentName = name;
+ this.isPrivate = isPrivate;
+ this.generateComponentPrefix(qualifier);
+ }
+
public ComponentNewValue(String uuid, String name, String key, boolean enabled, String path, String qualifier) {
this.componentUuid = uuid;
this.componentName = name;
return mapper(session).selectByUuids(uuids);
}
- public void updateVisibility(DbSession session, String uuid, boolean isPrivate, String qualifier) {
+ public void updateVisibility(DbSession session, String uuid, boolean isPrivate, String qualifier, String name) {
if (auditPersister != null) {
- auditPersister.updateComponentVisibility(session, new ComponentNewValue(uuid, isPrivate, qualifier), qualifier);
+ auditPersister.updateComponentVisibility(session, new ComponentNewValue(uuid, name, isPrivate, qualifier), qualifier);
}
mapper(session).updateVisibility(uuid, isPrivate, system2.now());
}
assertThat(newValue.toString()).contains("portfolioUuid");
}
+ @Test
+ public void toString_project_uuid_and_name_and_isPrivate() {
+ ComponentNewValue newValue = new ComponentNewValue("uuid", "name", true,"TRK");
+
+ assertThat(newValue.toString()).contains("\"projectUuid\": \"uuid\"");
+ assertThat(newValue.toString()).contains("\"projectName\": \"name\"");
+ assertThat(newValue.toString()).contains("\"isPrivate\": true");
+ }
+
@Test
public void toString_addsProjectPrefix() {
ComponentNewValue newValue = new ComponentNewValue("uuid", "name", "key", true, "path", "TRK");
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
assertProject(projectsByUuids.get(0), "projectName_p1", "projectKee_o1_p1", "uuid_o1_p1", "desc_p1", "tag1,tag2", true);
assertProject(projectsByUuids.get(1), "projectName_p2", "projectKee_o1_p2", "uuid_o1_p2", "desc_p2", "tag1,tag2", false);
- projectDao.updateVisibility(db.getSession(), dto1.getUuid(), false, Qualifiers.PROJECT);
- projectDao.updateVisibility(db.getSession(), dto2.getUuid(), true, Qualifiers.PROJECT);
+ projectDao.updateVisibility(db.getSession(), dto1.getUuid(), false, Qualifiers.PROJECT, dto1.getName());
+ projectDao.updateVisibility(db.getSession(), dto2.getUuid(), true, Qualifiers.PROJECT, dto2.getName());
projectsByUuids = projectDao.selectByUuids(db.getSession(), new HashSet<>(Arrays.asList("uuid_o1_p1", "uuid_o1_p2")));
assertThat(projectsByUuids).hasSize(2);
public void updateVisibility_shouldCallAuditPersister() {
ProjectDto dto1 = createProject("o1", "p1");
- projectDaoWithAuditPersister.updateVisibility(db.getSession(), dto1.getUuid(), false, Qualifiers.PROJECT);
+ projectDaoWithAuditPersister.updateVisibility(db.getSession(), dto1.getUuid(), false, Qualifiers.PROJECT, dto1.getName());
- verify(auditPersister, times(1)).updateComponentVisibility(any(), any(), any());
+ verify(auditPersister, times(1)).updateComponentVisibility(any(), any(), eq(Qualifiers.PROJECT));
}
@Test
dbClient.componentDao().setPrivateForRootComponentUuid(dbSession, uuid, isPrivate, component.qualifier());
if (component.qualifier().equals(Qualifiers.PROJECT) || component.qualifier().equals(Qualifiers.APP)) {
- dbClient.projectDao().updateVisibility(dbSession, uuid, isPrivate, component.qualifier());
+ dbClient.projectDao().updateVisibility(dbSession, uuid, isPrivate, component.qualifier(), component.name());
}
ComponentMapper mapper = dbSession.getMapper(ComponentMapper.class);