use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeServiceImplTest method getTemplateRepositorySuccessTest.
@Test
public void getTemplateRepositorySuccessTest() {
mockArchetypesOrgUnit();
final Archetype archetype = mock(Archetype.class);
doReturn(ArchetypeStatus.VALID).when(archetype).getStatus();
doReturn(archetype).when(archetypeConfigStorage).loadArchetype(Mockito.<String>any());
final Repository expectedRepository = mock(Repository.class);
doReturn(expectedRepository).when(repositoryService).getRepositoryFromSpace(Mockito.<Space>any(), eq(COMMON_ARCHETYPE_ALIAS));
final Repository repository = service.getTemplateRepository(COMMON_ARCHETYPE_ALIAS);
assertSame(expectedRepository, repository);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class LibraryServiceImpl method createProject.
@Override
public WorkspaceProject createProject(final OrganizationalUnit organizationalUnit, final String remoteRepositoryUrl, final String repositoryAlias) {
final String projectName = repositoryAlias != null ? repositoryAlias : DEFAULT_PROJECT_NAME;
final Optional<Archetype> baseArchetype = archetypeService.getBaseKieArchetype();
final String baseArchetypeAlias = baseArchetype.map(Archetype::getAlias).orElse(null);
final GAV gav = createGAV(projectName, organizationalUnit);
final POM pom = createPOM(projectName, projectName, gav);
return createProject(organizationalUnit, pom, DeploymentMode.VALIDATED, baseArchetypeAlias, remoteRepositoryUrl);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeConfigStorageTest method saveArchetypeTest.
@Test
public void saveArchetypeTest() {
final Archetype archetype = mock(Archetype.class);
doReturn(ARCHETYPE_ALIAS).when(archetype).getAlias();
archetypeConfigStorage.saveArchetype(archetype);
verify(objectStorage).write(eq(ARCHETYPE_PATH), same(archetype));
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeListingPredicatesTest method matchGavTest.
@Test
public void matchGavTest() {
final Function<GAV, Archetype> createArchetypeMock = gav -> {
final Archetype archetype = mock(Archetype.class);
doReturn(gav).when(archetype).getGav();
return archetype;
};
final GAV expectedGav = createGav("myArtifact1");
final List<Archetype> archetypes = Arrays.asList(createArchetypeMock.apply(expectedGav), createArchetypeMock.apply(createGav("myArtifact2")), createArchetypeMock.apply(createGav("myArtifact3")), createArchetypeMock.apply(createGav("myArtifact4")));
final List<Archetype> filteredList = archetypes.stream().filter(ArchetypeListingPredicates.matchGav(expectedGav)).collect(Collectors.toList());
assertThat(filteredList).hasSize(1);
assertThat(filteredList.get(0).getGav()).isSameAs(expectedGav);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.Archetype in project kie-wb-common by kiegroup.
the class ArchetypeServiceImpl method validateAll.
@Override
public void validateAll() {
getRepositories(matchAllRepositories()).forEach(item -> {
validateArchetype(item);
final Archetype archetype = archetypeConfigStorage.loadArchetype(item.getAlias());
if (archetype.isInternal().equals(Boolean.FALSE)) {
archetypePreferencesManager.addArchetype(archetype.getAlias());
}
});
}
Aggregations