use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class ExamplesServiceImplTest method testGetProjects_DefaultDescription.
@Test
public void testGetProjects_DefaultDescription() {
final Path moduleRoot = mock(Path.class);
final KieModule module = mock(KieModule.class);
when(module.getRootPath()).thenReturn(moduleRoot);
when(module.getModuleName()).thenReturn("module1");
when(moduleRoot.toURI()).thenReturn("default:///module1");
when(metadataService.getTags(any(Path.class))).thenReturn(Arrays.asList("tag1", "tag2"));
final GitRepository repository = makeGitRepository();
when(repositoryFactory.newRepository(any(ConfigGroup.class))).thenReturn(repository);
when(moduleService.getAllModules(any(Branch.class))).thenReturn(new HashSet<Module>() {
{
add(module);
}
});
service.setPlaygroundRepository(mock(ExampleRepository.class));
final Set<ExampleProject> modules = service.getProjects(new ExampleRepository("https://github.com/guvnorngtestuser1/guvnorng-playground.git"));
assertNotNull(modules);
assertEquals(1, modules.size());
assertTrue(modules.contains(new ExampleProject(moduleRoot, "module1", "Example 'module1' module", Arrays.asList("tag1", "tag2"))));
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class ExamplesServiceImplTest method testGetProjects_NullRepositoryUrl.
@Test
public void testGetProjects_NullRepositoryUrl() {
final Set<ExampleProject> modules = service.getProjects(new ExampleRepository(null));
assertNotNull(modules);
assertEquals(0, modules.size());
}
Aggregations