Search in sources :

Example 11 with ExampleRepository

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));
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) WizardPageStatusChangeEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent)

Example 12 with ExampleRepository

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);
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject)

Example 13 with ExampleRepository

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());
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) Test(org.junit.Test)

Example 14 with ExampleRepository

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));
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) WizardPageSelectedEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject) Test(org.junit.Test)

Example 15 with ExampleRepository

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());
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) Test(org.junit.Test)

Aggregations

ExampleRepository (org.kie.workbench.common.screens.examples.model.ExampleRepository)27 Test (org.junit.Test)19 ExampleProject (org.kie.workbench.common.screens.examples.model.ExampleProject)11 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)6 ConfigGroup (org.guvnor.structure.server.config.ConfigGroup)6 Module (org.guvnor.common.services.project.model.Module)4 Branch (org.guvnor.structure.repositories.Branch)3 Repository (org.guvnor.structure.repositories.Repository)3 KieModule (org.kie.workbench.common.services.shared.project.KieModule)3 Path (org.uberfire.backend.vfs.Path)3 HashSet (java.util.HashSet)2 ConfigType (org.guvnor.structure.server.config.ConfigType)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 URL (java.net.URL)1 HashMap (java.util.HashMap)1 ZipEntry (java.util.zip.ZipEntry)1 ZipInputStream (java.util.zip.ZipInputStream)1 PostConstruct (javax.annotation.PostConstruct)1 Git (org.eclipse.jgit.api.Git)1