@Test public void getBaseKieTemplateRepositoryWhenNotRegisteredTest() { mockArchetypesOrgUnit(); doReturn(null).when(archetypeConfigStorage).loadArchetype(anyString()); final Optional<Repository> repository = service.getBaseKieTemplateRepository(); assertFalse(repository.isPresent()); }
@Override public Optional<Repository> getBaseKieTemplateRepository() { final Optional<Archetype> archetype = getBaseKieArchetype(); if (!archetype.isPresent()) { LOGGER.warn("The base kie project template is not registered."); return Optional.empty(); } if (archetype.get().getStatus() != ArchetypeStatus.VALID) { LOGGER.warn("The state of base kie project template is invalid."); return Optional.empty(); } final String repositoryAlias = makeRepositoryAlias(BASE_KIE_PROJECT_TEMPLATE_GAV); return Optional.ofNullable(resolveRepository(repositoryAlias)); }
ArchetypeServiceImpl implements ArchetypeService { @Override public Optional<Repository> getBaseKieTemplateRepository() { final Optional<Archetype> archetype = getBaseKieArchetype(); if (!archetype.isPresent()) { LOGGER.warn("The base kie project template is not registered."); return Optional.empty(); } if (archetype.get().getStatus() != ArchetypeStatus.VALID) { LOGGER.warn("The state of base kie project template is invalid."); return Optional.empty(); } final String repositoryAlias = makeRepositoryAlias(BASE_KIE_PROJECT_TEMPLATE_GAV); return Optional.ofNullable(resolveRepository(repositoryAlias)); } }
ArchetypeServiceImpl implements ArchetypeService { @Override public Optional<Repository> getBaseKieTemplateRepository() { final Optional<Archetype> archetype = getBaseKieArchetype(); if (!archetype.isPresent()) { LOGGER.warn("The base kie project template is not registered."); return Optional.empty(); } if (archetype.get().getStatus() != ArchetypeStatus.VALID) { LOGGER.warn("The state of base kie project template is invalid."); return Optional.empty(); } final String repositoryAlias = makeRepositoryAlias(BASE_KIE_PROJECT_TEMPLATE_GAV); return Optional.ofNullable(resolveRepository(repositoryAlias)); } ArchetypeServiceImpl(); @Inject  ArchetypeServiceImpl(final @Named("ioStrategy") IOService ioService,
                                final RepositoryService repositoryService,
                                final OrganizationalUnitService ouService,
                                final Event<ArchetypeListUpdatedEvent> archetypeListUpdatedEvent,
                                final ArchetypeConfigStorage archetypeConfigStorage,
                                final PathUtil pathUtil,
                                final ArchetypePreferencesManager archetypePreferencesManager,
                                final KieModuleService moduleService,
                                final POMService pomService); }
ArchetypeServiceImpl implements ArchetypeService { @Override public Optional<Repository> getBaseKieTemplateRepository() { final Optional<Archetype> archetype = getBaseKieArchetype(); if (!archetype.isPresent()) { LOGGER.warn("The base kie project template is not registered."); return Optional.empty(); } if (archetype.get().getStatus() != ArchetypeStatus.VALID) { LOGGER.warn("The state of base kie project template is invalid."); return Optional.empty(); } final String repositoryAlias = makeRepositoryAlias(BASE_KIE_PROJECT_TEMPLATE_GAV); return Optional.ofNullable(resolveRepository(repositoryAlias)); } ArchetypeServiceImpl(); @Inject  ArchetypeServiceImpl(final @Named("ioStrategy") IOService ioService,
                                final RepositoryService repositoryService,
                                final OrganizationalUnitService ouService,
                                final Event<ArchetypeListUpdatedEvent> archetypeListUpdatedEvent,
                                final ArchetypeConfigStorage archetypeConfigStorage,
                                final PathUtil pathUtil,
                                final ArchetypePreferencesManager archetypePreferencesManager,
                                final KieModuleService moduleService,
                                final POMService pomService); void onNewOrganizationalUnitEvent(final @Observes NewOrganizationalUnitEvent newOrganizationalUnitEvent); @Override void add(final GAV archetypeGav); @Override void add(final GAV archetypeGav,
                    final GAV templateGav); @Override PaginatedArchetypeList list(final Integer page,
                                       final Integer pageSize,
                                       final String filter); @Override PaginatedArchetypeList list(final Integer page,
                                       final Integer pageSize,
                                       final String filter,
                                       final ArchetypeStatus status); @Override void delete(final String alias); @Override void validateAll(); @Override void validate(final String alias); @Override Repository getTemplateRepository(final String alias); @Override Optional<Repository> getBaseKieTemplateRepository(); @Override Optional<Archetype> getBaseKieArchetype(); }
ArchetypeServiceImpl implements ArchetypeService { @Override public Optional<Repository> getBaseKieTemplateRepository() { final Optional<Archetype> archetype = getBaseKieArchetype(); if (!archetype.isPresent()) { LOGGER.warn("The base kie project template is not registered."); return Optional.empty(); } if (archetype.get().getStatus() != ArchetypeStatus.VALID) { LOGGER.warn("The state of base kie project template is invalid."); return Optional.empty(); } final String repositoryAlias = makeRepositoryAlias(BASE_KIE_PROJECT_TEMPLATE_GAV); return Optional.ofNullable(resolveRepository(repositoryAlias)); } ArchetypeServiceImpl(); @Inject  ArchetypeServiceImpl(final @Named("ioStrategy") IOService ioService,
                                final RepositoryService repositoryService,
                                final OrganizationalUnitService ouService,
                                final Event<ArchetypeListUpdatedEvent> archetypeListUpdatedEvent,
                                final ArchetypeConfigStorage archetypeConfigStorage,
                                final PathUtil pathUtil,
                                final ArchetypePreferencesManager archetypePreferencesManager,
                                final KieModuleService moduleService,
                                final POMService pomService); void onNewOrganizationalUnitEvent(final @Observes NewOrganizationalUnitEvent newOrganizationalUnitEvent); @Override void add(final GAV archetypeGav); @Override void add(final GAV archetypeGav,
                    final GAV templateGav); @Override PaginatedArchetypeList list(final Integer page,
                                       final Integer pageSize,
                                       final String filter); @Override PaginatedArchetypeList list(final Integer page,
                                       final Integer pageSize,
                                       final String filter,
                                       final ArchetypeStatus status); @Override void delete(final String alias); @Override void validateAll(); @Override void validate(final String alias); @Override Repository getTemplateRepository(final String alias); @Override Optional<Repository> getBaseKieTemplateRepository(); @Override Optional<Archetype> getBaseKieArchetype();  }