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();
}
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());
}
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);
}
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());
}
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);
}
Aggregations