use of org.guvnor.common.services.shared.metadata.model.Metadata 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.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.
the class ProjectScreenModelLoaderTest method testKModule.
@Test
public void testKModule() throws Exception {
final KModuleModel kModuleModel = new KModuleModel();
when(kModuleService.load(kmoduleXMLPath)).thenReturn(kModuleModel);
final Metadata metadata = new Metadata();
when(metadataService.getMetadata(kmoduleXMLPath)).thenReturn(metadata);
ProjectScreenModel model = loader.load(pathToPom);
assertEquals(kmoduleXMLPath, model.getPathToKModule());
assertEquals(kModuleModel, model.getKModule());
assertEquals(metadata, model.getKModuleMetaData());
}
use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.
the class ProjectScreenModelLoaderTest method testLoadPom.
@Test
public void testLoadPom() throws Exception {
final POM pom = new POM();
when(pomService.load(pathToPom)).thenReturn(pom);
final Metadata metadata = new Metadata();
when(metadataService.getMetadata(pathToPom)).thenReturn(metadata);
ProjectScreenModel model = loader.load(pathToPom);
assertEquals(pathToPom, model.getPathToPOM());
assertEquals(pom, model.getPOM());
assertEquals(metadata, model.getPOMMetaData());
}
use of org.guvnor.common.services.shared.metadata.model.Metadata in project kie-wb-common by kiegroup.
the class ProjectScreenModelSaverTest method checkPOMSaveInvalidatesPomModelCache.
@Test
public void checkPOMSaveInvalidatesPomModelCache() {
// See https://issues.jboss.org/browse/RHBRMS-2822
// Saving the pom.xml (eventually) triggers an InvalidateDMOProjectCacheEvent once VFS's WatchService
// has observed the file change after the batch has been committed. The InvalidateDMOProjectCacheEvent then
// invalidates the PomModelCache. The PomModelCache is used to find the Project's GAV when the Project is
// "Built (& Deployed)" and if it's content is stale can lead to the generated KJAR containing the
// wrong GAV. Therefore invalidate the PomModelCache as soon as the save starts.
final ProjectScreenModel model = new ProjectScreenModel();
final Metadata pomMetaData = new Metadata();
final POM pom = new POM();
model.setPOM(pom);
model.setPOMMetaData(pomMetaData);
KieModule module = mock(KieModule.class);
when(moduleService.resolveModule(pathToPom)).thenReturn(module);
saver.save(pathToPom, model, DeploymentMode.FORCED, "message");
verify(pomModelCache).invalidateCache(module);
}
use of org.guvnor.common.services.shared.metadata.model.Metadata 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"));
}
Aggregations