use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class SourceRepositoryPage method isComplete.
@Override
public void isComplete(final Callback<Boolean> callback) {
final ExampleRepository selectedRepository = model.getSelectedRepository();
callback.callback(validateUrl(selectedRepository));
}
use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class SourceRepositoryPageTest method testIsComplete_ValidRepositoryUrl.
@Test
@SuppressWarnings("unchecked")
public void testIsComplete_ValidRepositoryUrl() {
final ExampleRepository repository = new ExampleRepository(EXAMPLE_REPOSITORY);
model.setSelectedRepository(repository);
final Callback<Boolean> callback = mock(Callback.class);
page.isComplete(callback);
verify(callback, times(1)).callback(eq(true));
verify(view, times(1)).setUrlGroupType(eq(ValidationState.NONE));
verify(view, times(1)).hideUrlHelpMessage();
assertTrue(repository.isUrlValid());
}
use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class SourceRepositoryPageTest method testIsComplete_EmptyRepositoryUrl.
@Test
@SuppressWarnings("unchecked")
public void testIsComplete_EmptyRepositoryUrl() {
final ExampleRepository repository = new ExampleRepository("");
model.setSelectedRepository(repository);
final Callback<Boolean> callback = mock(Callback.class);
page.isComplete(callback);
verify(callback, times(1)).callback(eq(false));
verify(view, times(1)).setUrlGroupType(eq(ValidationState.ERROR));
verify(view, times(1)).showUrlHelpMessage(any(String.class));
assertFalse(repository.isUrlValid());
}
use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class LibraryServiceImpl method getExampleProjects.
@Override
public Set<ExampleProject> getExampleProjects() {
final String importProjectsUrl = getCustomImportProjectsUrl();
final ExampleRepository repository = importProjectsUrl == null || importProjectsUrl.isEmpty() ? examplesService.getPlaygroundRepository() : new ExampleRepository(importProjectsUrl);
final Set<ExampleProject> projects = examplesService.getProjects(repository);
return projects;
}
use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method getCustomExampleProjectsTest.
@Test
public void getCustomExampleProjectsTest() {
System.setProperty("org.kie.project.examples.repository.url", "importProjectsUrl");
final Set<ExampleProject> exampleProjects = new HashSet<>();
exampleProjects.add(mock(ExampleProject.class));
doReturn(exampleProjects).when(examplesService).getProjects(new ExampleRepository("importProjectsUrl"));
final Set<ExampleProject> loadedExampleProjects = libraryService.getExampleProjects();
assertEquals(exampleProjects, loadedExampleProjects);
}
Aggregations