use of org.guvnor.ala.source.Repository in project kie-wb-common by kiegroup.
the class MavenProjectConfigExecutorTest method testAPI.
@Test
public void testAPI() {
final SourceRegistry sourceRegistry = new InMemorySourceRegistry();
final BuildRegistry buildRegistry = new InMemoryBuildRegistry();
final Pipeline pipe = PipelineFactory.newBuilder().addConfigStage("Git Source", new MyGitConfig()).addConfigStage("Maven Project", new MavenProjectConfigImpl()).addConfigStage("Maven Build Config", new MavenBuildConfigImpl()).addConfigStage("Maven Build", new MavenBuildExecConfigImpl()).buildAs("my pipe");
final PipelineExecutor executor = new PipelineExecutor(asList(new GitConfigExecutor(sourceRegistry), new MavenProjectConfigExecutor(sourceRegistry), new MavenBuildConfigExecutor(), new MavenBuildExecConfigExecutor(buildRegistry)));
executor.execute(new Input() {
{
put("repo-name", "drools-workshop-pipe");
put("create-repo", "true");
put("branch", "master");
put("out-dir", tempPath.getAbsolutePath());
put("origin", gitUrl);
}
}, pipe, System.out::println);
List<Repository> allRepositories = sourceRegistry.getAllRepositories();
assertEquals(1, allRepositories.size());
Repository repo = allRepositories.get(0);
List<Project> allProjects = sourceRegistry.getAllProjects(repo);
assertEquals(1, allProjects.size());
List<Binary> allBinaries = buildRegistry.getAllBinaries();
assertEquals(1, allBinaries.size());
assertMavenBinary(allBinaries.get(0), allProjects.get(0));
final String tempDir = sourceRegistry.getAllProjects(repo).get(0).getTempDir();
executor.execute(new Input() {
{
put("project-temp-dir", tempDir);
put("repo-name", "drools-workshop-pipe");
put("branch", "master");
}
}, pipe, System.out::println);
allRepositories = sourceRegistry.getAllRepositories();
assertEquals(1, allRepositories.size());
repo = allRepositories.get(0);
allProjects = sourceRegistry.getAllProjects(repo);
assertEquals(2, allProjects.size());
allBinaries = buildRegistry.getAllBinaries();
assertEquals(1, allBinaries.size());
assertMavenBinary(allBinaries.get(0), allProjects.get(1));
}
use of org.guvnor.ala.source.Repository in project kie-wb-common by kiegroup.
the class InMemorySourceRegistryTest method testGetAllRepositories.
@Test
public void testGetAllRepositories() {
List<Repository> repositories = new ArrayList<>();
List<Path> paths = new ArrayList<>();
for (int i = 0; i < REPOSITORIES_SIZE; i++) {
paths.add(mock(Path.class));
Repository repository = mock(Repository.class);
when(repository.getId()).thenReturn(REPOSITORY_ID + Integer.toString(i));
repositories.add(repository);
}
for (int i = 0; i < REPOSITORIES_SIZE; i++) {
sourceRegistry.registerRepositorySources(paths.get(i), repositories.get(i));
}
List<Repository> result = sourceRegistry.getAllRepositories();
assertEquals(repositories.size(), result.size());
for (Repository repository : repositories) {
assertTrue(result.contains(repository));
}
}
use of org.guvnor.ala.source.Repository in project kie-wb-common by kiegroup.
the class MavenProjectConfigExecutorTest method testReuseTmpDirectoryAPI.
@Test
public void testReuseTmpDirectoryAPI() {
final SourceRegistry sourceRegistry = new InMemorySourceRegistry();
final BuildRegistry buildRegistry = new InMemoryBuildRegistry();
final Pipeline pipe = PipelineFactory.newBuilder().addConfigStage("Git Source", new MyGitConfig()).addConfigStage("Maven Project", new MavenProjectConfigImpl()).addConfigStage("Maven Build Config", new MavenBuildConfigImpl()).addConfigStage("Maven Build", new MavenBuildExecConfigImpl()).buildAs("my pipe");
final PipelineExecutor executor = new PipelineExecutor(asList(new GitConfigExecutor(sourceRegistry), new MavenProjectConfigExecutor(sourceRegistry), new MavenBuildConfigExecutor(), new MavenBuildExecConfigExecutor(buildRegistry)));
executor.execute(new Input() {
{
put("repo-name", "drools-workshop-pipe2");
put("create-repo", "true");
put("branch", "master");
put("out-dir", tempPath.getAbsolutePath());
put("origin", gitUrl);
}
}, pipe, System.out::println);
List<Repository> allRepositories = sourceRegistry.getAllRepositories();
assertEquals(1, allRepositories.size());
Repository repo = allRepositories.get(0);
List<Project> allProjects = sourceRegistry.getAllProjects(repo);
assertEquals(1, allProjects.size());
List<Binary> allBinaries = buildRegistry.getAllBinaries();
assertEquals(1, allBinaries.size());
assertMavenBinary(allBinaries.get(0), allProjects.get(0));
final String tempDir = sourceRegistry.getAllProjects(repo).get(0).getTempDir();
executor.execute(new Input() {
{
put("project-temp-dir", tempDir);
put("repo-name", "drools-workshop-pipe2");
put("branch", "master");
}
}, pipe, System.out::println);
allRepositories = sourceRegistry.getAllRepositories();
assertEquals(1, allRepositories.size());
repo = allRepositories.get(0);
allProjects = sourceRegistry.getAllProjects(repo);
assertEquals(2, allProjects.size());
allBinaries = buildRegistry.getAllBinaries();
assertEquals(1, allBinaries.size());
assertMavenBinary(allBinaries.get(0), allProjects.get(1));
}
Aggregations