use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class BaseViewPresenterTest method testAutomaticModuleBuildDisabled.
@Test
public void testAutomaticModuleBuildDisabled() {
final OrganizationalUnit ou = mock(OrganizationalUnit.class);
final Repository repository = mock(Repository.class);
final Module module = mock(Module.class);
ApplicationPreferences.setUp(new HashMap<String, String>() {
{
put(ExplorerService.BUILD_PROJECT_PROPERTY_NAME, "true");
}
});
when(activeContextItems.setupActiveModule(content)).thenReturn(true);
final WorkspaceProject project = mock(WorkspaceProject.class);
when(project.getOrganizationalUnit()).thenReturn(ou);
when(project.getRepository()).thenReturn(repository);
when(project.getBranch()).thenReturn(new Branch("master", mock(Path.class)));
when(activeContextItems.getActiveProject()).thenReturn(project);
when(activeContextItems.getActiveModule()).thenReturn(module);
presenter.doContentCallback(content);
verify(buildServiceActual, never()).build(any(Module.class));
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ProjectScreenServiceImplTest method testDelete.
@Test
public void testDelete() throws Exception {
final WorkspaceProject project = mock(WorkspaceProject.class);
final Repository repository = mock(Repository.class);
final String ouName = "test-realm";
final Space space = new Space(ouName);
doReturn(repository).when(project).getRepository();
doReturn("myrepo").when(repository).getAlias();
doReturn(space).when(repository).getSpace();
service.delete(project);
verify(repositoryService).removeRepository(eq(space), eq("myrepo"));
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ProjectScreenServiceImplTest method testCopyNoPOM.
@Test
public void testCopyNoPOM() throws Exception {
final WorkspaceProject project = mock(WorkspaceProject.class);
final OrganizationalUnit ou = mock(OrganizationalUnit.class);
final Path projectRoot = mock(Path.class);
doReturn(ou).when(project).getOrganizationalUnit();
doReturn(projectRoot).when(project).getRootPath();
final Repository newRepository = mock(Repository.class);
final Path newRepositoryRoot = PathFactory.newPath("root", "file:///root");
doReturn(Optional.of(new Branch("master", newRepositoryRoot))).when(newRepository).getDefaultBranch();
doReturn(newRepository).when(repositoryCopier).copy(ou, "newName", projectRoot);
doReturn(null).when(pomService).load(any(Path.class));
service.copy(project, "newName");
verify(repositoryCopier).copy(ou, "newName", projectRoot);
verify(metadataService, never()).getMetadata(any(Path.class));
verify(pomService, never()).save(any(Path.class), any(POM.class), any(Metadata.class), anyString(), anyBoolean());
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class NewWorkspaceProjectWizard method getSuccessCallback.
private RemoteCallback<WorkspaceProject> getSuccessCallback() {
return new RemoteCallback<WorkspaceProject>() {
@Override
public void callback(final WorkspaceProject project) {
NewWorkspaceProjectWizard.super.complete();
invokeCallback(project);
if (openEditor) {
placeManager.goTo("ProjectSettings");
}
notificationEvent.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemCreatedSuccessfully()));
busyIndicatorView.hideBusyIndicator();
}
};
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ContributorsManager method buildDataSet.
@Override
public DataSet buildDataSet(Map<String, String> params) {
final DataSetBuilder dsBuilder = DataSetFactory.newDataSetBuilder();
for (final DataColumnDef columnDef : dataSetdef.getColumns()) {
dsBuilder.column(columnDef.getId(), columnDef.getColumnType());
}
final Collection<OrganizationalUnit> orgUnitList = organizationalUnitService.getOrganizationalUnits();
for (final OrganizationalUnit orgUnit : orgUnitList) {
final String org = orgUnit.getName();
final Collection<WorkspaceProject> projects = projectService.getAllWorkspaceProjects(orgUnit);
if (projects.isEmpty()) {
// org
dsBuilder.row(// org
org, // repo
null, // project
null, // author
null, // message
"Empty organizational unit", // date
null);
} else {
for (final WorkspaceProject project : projects) {
final String repoAlias = project.getRepository().getAlias();
final String projectName = project.getName();
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
final Path projectRoot = Paths.convert(rootPath);
final List<VersionRecord> recordList = recordService.loadVersionRecords(projectRoot);
if (recordList.isEmpty()) {
// org
dsBuilder.row(// org
org, // repo
repoAlias, // project
null, // author
null, // mesage
"Empty project", // date
null);
} else {
for (VersionRecord record : recordList) {
String alias = record.author();
String author = authorMappings.getProperty(alias);
author = author == null ? alias : author;
String msg = record.comment();
Date date = record.date();
dsBuilder.row(org, repoAlias, projectName, author, msg, date);
}
}
}
}
}
DataSet dataSet = dsBuilder.buildDataSet();
dataSet.setUUID(GIT_CONTRIB);
return dataSet;
}
Aggregations