use of org.guvnor.common.services.project.model.ProjectImports in project kie-wb-common by kiegroup.
the class ExternalDataObjectsPresenterTest method testSetup.
@Test
public void testSetup() {
final ProjectScreenModel model = mock(ProjectScreenModel.class);
doReturn(new ProjectImports()).when(model).getProjectImports();
externalDataObjectsPresenter.setup(model).catch_(i -> {
Assert.fail("Promise should've been resolved!");
return promises.resolve();
});
verify(view).init(eq(externalDataObjectsPresenter));
verify(itemPresenters).setup(any(), any(), any());
}
use of org.guvnor.common.services.project.model.ProjectImports in project kie-wb-common by kiegroup.
the class ProjectImportsScreenPresenterTest method testGetContentSupplier.
@Test
public void testGetContentSupplier() {
final ProjectImports content = mock(ProjectImports.class);
presenter.setModel(content);
final Supplier<ProjectImports> contentSupplier = presenter.getContentSupplier();
assertEquals(content, contentSupplier.get());
}
use of org.guvnor.common.services.project.model.ProjectImports in project kie-wb-common by kiegroup.
the class ProjectScreenModelLoaderTest method testImports.
@Test
public void testImports() throws Exception {
final ProjectImports projectImports = new ProjectImports();
when(projectImportsService.load(importsPath)).thenReturn(projectImports);
final Metadata metadata = new Metadata();
when(metadataService.getMetadata(importsPath)).thenReturn(metadata);
ProjectScreenModel model = loader.load(pathToPom);
assertEquals(importsPath, model.getPathToImports());
assertEquals(projectImports, model.getProjectImports());
assertEquals(metadata, model.getProjectImportsMetaData());
}
use of org.guvnor.common.services.project.model.ProjectImports in project kie-wb-common by kiegroup.
the class ProjectScreenModelSaverTest method testImportsSave.
@Test
public void testImportsSave() throws Exception {
final ProjectScreenModel model = new ProjectScreenModel();
final ProjectImports projectImports = new ProjectImports();
model.setProjectImports(projectImports);
final Path pathToImports = mock(Path.class);
model.setPathToImports(pathToImports);
final Metadata metadata = new Metadata();
model.setProjectImportsMetaData(metadata);
saver.save(pathToPom, model, DeploymentMode.FORCED, "message imports");
verify(importsService).save(eq(pathToImports), eq(projectImports), eq(metadata), eq("message imports"));
}
use of org.guvnor.common.services.project.model.ProjectImports in project kie-wb-common by kiegroup.
the class ProjectScreenServiceImplTest method setup.
@Before
public void setup() {
projectImports = new ProjectImports();
moduleRepositories = new ModuleRepositories();
loader = new ProjectScreenModelLoader(moduleService, pomService, metadataService, kModuleService, importsService, repositoriesService, allowListService, projectService) {
@Override
protected boolean fileExists(final Path path) {
return true;
}
};
saver = new ProjectScreenModelSaver(pomService, kModuleService, importsService, repositoriesService, allowListService, ioService, moduleService, repositoryResolver, commentedOptionFactory, pomModelCache);
service = new ProjectScreenServiceImpl(projectService, repositoryService, moduleService, loader, saver, repositoryCopier, pomService, metadataService, newProjectEvent);
when(module.getKModuleXMLPath()).thenReturn(pathToKieModule);
when(module.getImportsPath()).thenReturn(pathToModuleImports);
when(module.getRepositoriesPath()).thenReturn(pathToModuleRepositories);
when(module.getPom()).thenReturn(pom);
when(pathToPom.toURI()).thenReturn("default://pom.xml");
when(pomService.load(eq(pathToPom))).thenReturn(pom);
when(kModuleService.load(eq(pathToKieModule))).thenReturn(kmodule);
when(importsService.load(eq(pathToModuleImports))).thenReturn(projectImports);
when(repositoriesService.load(eq(pathToModuleRepositories))).thenReturn(moduleRepositories);
when(moduleService.resolveModule(eq(pathToPom))).thenReturn(module);
when(metadataService.getMetadata(eq(pathToPom))).thenReturn(pomMetaData);
when(metadataService.getMetadata(eq(pathToKieModule))).thenReturn(kmoduleMetaData);
when(metadataService.getMetadata(eq(pathToModuleImports))).thenReturn(projectImportsMetaData);
when(projectService.resolveProject((Path) any())).thenReturn(spy(new WorkspaceProject(mock(OrganizationalUnit.class), new GitRepository("alias", mock(Space.class), emptyList()), mock(Branch.class), mock(Module.class))));
}
Aggregations