use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeServiceImpl method finishAddArchetype.
private Archetype finishAddArchetype(final GAV templateGav, final File repositoryDirectory, final boolean internal) throws GitAPIException, MavenEmbedderException {
final Repository repository = makeArchetypeAvailable(templateGav, repositoryDirectory);
final Archetype archetype = new Archetype(repository.getAlias(), templateGav, new Date(), ArchetypeStatus.VALID, internal);
archetypeConfigStorage.saveArchetype(archetype);
LOGGER.info("Archetype {} successfully added.", templateGav);
return archetype;
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeServiceImpl method updateArchetypeStatus.
private void updateArchetypeStatus(final String alias, final ArchetypeStatus status, final String message) {
final Archetype archetype = archetypeConfigStorage.loadArchetype(alias);
final Archetype updatedArchetype = new Archetype(archetype.getAlias(), archetype.getGav(), archetype.getCreatedDate(), status, message, archetype.isInternal());
archetypeConfigStorage.saveArchetype(updatedArchetype);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeItemPresenterTest method setupWhenIsNotIncludedTest.
@Test
public void setupWhenIsNotIncludedTest() {
final Archetype archetype = createArchetypeWithStatus(ArchetypeStatus.VALID);
final ArchetypeItem archetypeItem = new ArchetypeItem(archetype, false, true);
presenter.setup(archetypeItem, tablePresenter);
verify(view).setIncluded(false);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeItemPresenterTest method setIncludedWhenIsNotValidTest.
@Test
public void setIncludedWhenIsNotValidTest() {
final Archetype archetype = createArchetypeWithStatus(ArchetypeStatus.INVALID);
final ArchetypeItem archetypeItem = new ArchetypeItem(archetype, true, true);
doReturn(true).when(tablePresenter).canMakeChanges();
presenter.setup(archetypeItem, tablePresenter);
presenter.setIncluded(true);
verify(view, never()).checkIncluded(anyBoolean());
verify(tablePresenter, never()).setSelected(any(), anyBoolean());
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeItemPresenterTest method setupWhenAllEnabledTest.
@Test
public void setupWhenAllEnabledTest() {
final Archetype archetype = createArchetypeWithStatus(ArchetypeStatus.VALID);
final ArchetypeItem archetypeItem = new ArchetypeItem(archetype, true, true);
doReturn(true).when(tablePresenter).isShowIncludeColumn();
doReturn(true).when(tablePresenter).isShowStatusColumn();
doReturn(true).when(tablePresenter).isShowDeleteAction();
doReturn(true).when(tablePresenter).isShowValidateAction();
presenter.setup(archetypeItem, tablePresenter);
verify(view).init(presenter);
verify(view).setIncluded(archetypeItem.isSelected());
verify(view).setGroupId(archetype.getGav().getGroupId());
verify(view).setArtifactId(archetype.getGav().getArtifactId());
verify(view).setVersion(archetype.getGav().getVersion());
verify(view).setCreatedDate(ArchetypeItemPresenter.DATE_FORMAT.format(archetype.getCreatedDate()));
verify(view).showInclude(true);
verify(view).showStatus(true);
verify(view).showDeleteAction(true);
verify(view).showValidateAction(true);
verify(view).showDefaultBadge(true);
verify(view).enableIncludeCheckbox(true);
verify(view).enableSetDefault(true);
verify(view).setDeleteCommand(any());
verify(view).setDefaultBadgeTooltip(Mockito.<String>any());
}
Aggregations