Search in sources :

Example 16 with ExampleRepository

use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.

the class SourceRepositoryPageTest method testSetPlaygroundRepository.

@Test
public void testSetPlaygroundRepository() {
    ExampleRepository repository = new ExampleRepository(EXAMPLE_REPOSITORY);
    page.setPlaygroundRepository(repository);
    verify(view, times(1)).hideRepositoryUrlInputForm();
    verify(view, times(1)).setStockRepositoryOption();
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) Test(org.junit.Test)

Example 17 with ExampleRepository

use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.

the class SourceRepositoryPageTest method testIsComplete_InvalidRepositoryUrl.

@Test
@SuppressWarnings("unchecked")
public void testIsComplete_InvalidRepositoryUrl() {
    final ExampleRepository repository = new ExampleRepository("cheese");
    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());
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) Test(org.junit.Test)

Example 18 with ExampleRepository

use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.

the class LibraryServiceImplTest method getDefaultExampleProjectsTest.

@Test
public void getDefaultExampleProjectsTest() {
    System.setProperty("org.kie.project.examples.repository.url", "");
    final ExampleRepository playgroundRepository = new ExampleRepository("playgroundRepositoryUrl");
    doReturn(playgroundRepository).when(examplesService).getPlaygroundRepository();
    final Set<ExampleProject> exampleProjects = new HashSet<>();
    exampleProjects.add(mock(ExampleProject.class));
    doReturn(exampleProjects).when(examplesService).getProjects(playgroundRepository);
    final Set<ExampleProject> loadedExampleProjects = libraryService.getExampleProjects();
    assertEquals(exampleProjects, loadedExampleProjects);
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 19 with ExampleRepository

use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.

the class ExamplesServiceImplCheckNoIndexConfigTest method testCheckRepositoryConfig_NoIndex.

@Test
public void testCheckRepositoryConfig_NoIndex() {
    final ConfigGroup configGroup = new ConfigGroup();
    doReturn(configGroup).when(configurationFactory).newConfigGroup(any(ConfigType.class), anyString(), anyString(), anyString());
    service.getProjects(new ExampleRepository("https://github.com/guvnorngtestuser1/guvnorng-playground.git"));
    final ConfigItem item = configGroup.getConfigItem(EnvironmentParameters.AVOID_INDEX);
    assertNotNull(item);
    assertEquals("true", item.getValue());
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) ConfigItem(org.guvnor.structure.server.config.ConfigItem) ConfigGroup(org.guvnor.structure.server.config.ConfigGroup) ConfigType(org.guvnor.structure.server.config.ConfigType) Test(org.junit.Test)

Example 20 with ExampleRepository

use of org.kie.workbench.common.screens.examples.model.ExampleRepository in project kie-wb-common by kiegroup.

the class ExamplesServiceImplTest method initPlaygroundRepository.

@Test
public void initPlaygroundRepository() {
    // Emulate @PostConstruct mechanism
    service.initPlaygroundRepository();
    final ExampleRepository exampleRepository = service.getPlaygroundRepository();
    assertNotNull(exampleRepository);
}
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