use of org.guvnor.structure.organizationalunit.OrganizationalUnit 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.structure.organizationalunit.OrganizationalUnit 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.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class NewWorkspaceProjectHandler method getCommand.
@Override
public Command getCommand(final NewResourcePresenter newResourcePresenter) {
return new Command() {
@Override
public void execute() {
if (!context.getActiveOrganizationalUnit().isPresent()) {
ouService.call(new RemoteCallback<OrganizationalUnit>() {
@Override
public void callback(OrganizationalUnit organizationalUnit) {
projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(organizationalUnit));
init();
}
}).getOrganizationalUnit(libraryPreferences.getOrganizationalUnitPreferences().getName());
} else {
init();
}
}
};
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class NewWorkspaceProjectWizardTest method testSetContentGAV.
@Test
public void testSetContentGAV() throws Exception {
preferences.put("kie_version", "1.3.0");
OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
when(organizationalUnit.getDefaultGroupId()).thenReturn("mygroup");
when(moduleContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(organizationalUnit));
POM pom = new POM();
pom.setName("another module");
pom.getGav().setArtifactId("another.artifact");
pom.getGav().setGroupId("another.group");
pom.getGav().setVersion("1.2.3");
wizard.initialise(pom);
ArgumentCaptor<POM> pomArgumentCaptor = ArgumentCaptor.forClass(POM.class);
verify(pomWizardPage).setPom(pomArgumentCaptor.capture());
POM result = pomArgumentCaptor.getValue();
assertEquals("1.2.3", result.getGav().getVersion());
assertEquals("another.artifact", result.getGav().getArtifactId());
assertEquals("another.group", result.getGav().getGroupId());
assertEquals("another module", result.getName());
assertEquals(1, result.getBuild().getPlugins().size());
assertEquals("1.3.0", result.getBuild().getPlugins().get(0).getVersion());
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit 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