use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class SourceRepositoryPage method onCustomRepositoryValueChanged.
@Override
public void onCustomRepositoryValueChanged() {
model.setSelectedRepository(new ExampleRepository(view.getCustomRepositoryValue()));
pageStatusChangedEvent.fire(new WizardPageStatusChangeEvent(this));
}
use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class ProjectPageTest method initExampleProjects.
private void initExampleProjects() {
when(examplesService.getProjects(any(ExampleRepository.class))).thenReturn(new HashSet<ExampleProject>() {
{
add(project1);
add(project2);
}
});
final ExampleRepository repository = new ExampleRepository(EXAMPLE_REPOSITORY);
model.setSelectedRepository(repository);
page.prepareView();
Mockito.reset(projectsView, pageSelectedEvent);
}
use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class ProjectPageTest method testPrepareView_InvalidRepositorySelected.
@Test
public void testPrepareView_InvalidRepositorySelected() {
final ExampleRepository repository = new ExampleRepository("cheese");
repository.setUrlValid(false);
model.setSelectedRepository(repository);
page.prepareView();
assertEquals(noRepositoryURLViewWidget, page.asWidget());
}
use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class ProjectPageTest method testPrepareView_NewRepositorySelected.
@Test
public void testPrepareView_NewRepositorySelected() {
when(examplesService.getProjects(any(ExampleRepository.class))).thenReturn(new HashSet<ExampleProject>() {
{
add(project1);
add(project2);
}
});
final ExampleRepository repository = new ExampleRepository(EXAMPLE_REPOSITORY);
model.setSelectedRepository(repository);
page.prepareView();
assertEquals(projectsViewWidget, page.asWidget());
assertEquals(repository, model.getSourceRepository());
assertTrue(model.getProjects().isEmpty());
verify(projectsView, times(1)).setProjectsInRepository(projectsArgumentCaptor.capture());
final List<ExampleProject> sortedProjects = projectsArgumentCaptor.getValue();
assertNotNull(sortedProjects);
assertEquals(2, sortedProjects.size());
assertEquals("project1", sortedProjects.get(0).getName());
assertEquals("project2", sortedProjects.get(1).getName());
verify(pageSelectedEvent, times(1)).fire(any(WizardPageSelectedEvent.class));
}
use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.
the class ProjectPageTest method testPrepareView_SameRepositorySelected.
@Test
public void testPrepareView_SameRepositorySelected() {
final ExampleRepository repository = new ExampleRepository(EXAMPLE_REPOSITORY);
model.setSourceRepository(repository);
model.setSelectedRepository(repository);
page.prepareView();
assertEquals(projectsViewWidget, page.asWidget());
}
Aggregations