use of org.guvnor.common.services.project.builder.model.BuildResults in project kie-wb-common by kiegroup.
the class BuilderTest method testBuilderKModuleHasDependency.
@Test
public void testBuilderKModuleHasDependency() throws Exception {
URL url = this.getClass().getResource("/GuvnorM2RepoDependencyExample2");
SimpleFileSystemProvider p = new SimpleFileSystemProvider();
org.uberfire.java.nio.file.Path path = p.getPath(url.toURI());
final Module module = moduleService.resolveModule(Paths.convert(path));
final Builder builder = new Builder(module, ioService, moduleService, importsService, new ArrayList<>(), dependenciesClassLoaderCache, pomModelCache, getPackageNameWhiteListService(), alwaysTrue);
final BuildResults results = builder.build();
// Debug output
if (!results.getMessages().isEmpty()) {
for (BuildMessage m : results.getMessages()) {
logger.debug(m.getText());
}
}
assertTrue(results.getMessages().isEmpty());
}
use of org.guvnor.common.services.project.builder.model.BuildResults in project kie-wb-common by kiegroup.
the class BuilderTest method testBuilderKModuleHasDependencyMetaData.
@Test
public void testBuilderKModuleHasDependencyMetaData() throws Exception {
URL url = this.getClass().getResource("/GuvnorM2RepoDependencyExample2");
SimpleFileSystemProvider p = new SimpleFileSystemProvider();
org.uberfire.java.nio.file.Path path = p.getPath(url.toURI());
final Module module = moduleService.resolveModule(Paths.convert(path));
final Builder builder = new Builder(module, ioService, moduleService, importsService, new ArrayList<>(), dependenciesClassLoaderCache, pomModelCache, getPackageNameWhiteListService(), alwaysTrue);
final BuildResults results = builder.build();
// Debug output
if (!results.getMessages().isEmpty()) {
for (BuildMessage m : results.getMessages()) {
logger.debug(m.getText());
}
}
assertTrue(results.getMessages().isEmpty());
final KieModuleMetaData metaData = KieModuleMetaData.Factory.newKieModuleMetaData(builder.getKieModule());
// Check packages
final Set<String> packageNames = new HashSet<>();
final Iterator<String> packageNameIterator = metaData.getPackages().iterator();
while (packageNameIterator.hasNext()) {
packageNames.add(packageNameIterator.next());
}
assertEquals(2, packageNames.size());
assertTrue(packageNames.contains("defaultpkg"));
assertTrue(packageNames.contains("org.kie.workbench.common.services.builder.tests.test1"));
// Check classes
final String packageName = "org.kie.workbench.common.services.builder.tests.test1";
assertEquals(1, metaData.getClasses(packageName).size());
final String className = metaData.getClasses(packageName).iterator().next();
assertEquals("Bean", className);
// Check metadata
final Class clazz = metaData.getClass(packageName, className);
final TypeMetaInfo typeMetaInfo = metaData.getTypeMetaInfo(clazz);
assertNotNull(typeMetaInfo);
assertFalse(typeMetaInfo.isEvent());
}
use of org.guvnor.common.services.project.builder.model.BuildResults in project kie-wb-common by kiegroup.
the class BuilderTest method testKModuleContainsXLS.
@Test
public void testKModuleContainsXLS() throws Exception {
URL url = this.getClass().getResource("/ExampleWithExcel");
SimpleFileSystemProvider p = new SimpleFileSystemProvider();
org.uberfire.java.nio.file.Path path = p.getPath(url.toURI());
final Module module = moduleService.resolveModule(Paths.convert(path));
final Builder builder = new Builder(module, ioService, moduleService, importsService, new ArrayList<>(), dependenciesClassLoaderCache, pomModelCache, getPackageNameWhiteListService(), alwaysTrue);
final BuildResults results = builder.build();
// Debug output
if (!results.getMessages().isEmpty()) {
for (BuildMessage m : results.getMessages()) {
logger.debug(m.getText());
}
}
assertTrue(results.getMessages().isEmpty());
}
use of org.guvnor.common.services.project.builder.model.BuildResults in project kie-wb-common by kiegroup.
the class ResourceChangeIncrementalBuilderTest method testResourceAdded.
@Test
public void testResourceAdded() throws Exception {
final URL resourceUrl = this.getClass().getResource("/BuildChangeListenerRepo/src/main/resources/add.drl");
final org.uberfire.java.nio.file.Path nioResourcePath = fs.getPath(resourceUrl.toURI());
final Path resourcePath = paths.convert(nioResourcePath);
// Force full build before attempting incremental changes
final KieModule module = moduleService.resolveModule(resourcePath);
final BuildResults buildResults = buildService.build(module);
assertNotNull(buildResults);
assertEquals(0, buildResults.getErrorMessages().size());
assertEquals(1, buildResults.getInformationMessages().size());
// Perform incremental build
buildChangeListener.addResource(resourcePath);
waitForIncrementalBuildResults(buildResultsObserver);
final IncrementalBuildResults incrementalBuildResults = buildResultsObserver.getIncrementalBuildResults();
assertNotNull(incrementalBuildResults);
assertEquals(0, incrementalBuildResults.getAddedMessages().size());
assertEquals(0, incrementalBuildResults.getRemovedMessages().size());
}
use of org.guvnor.common.services.project.builder.model.BuildResults in project kie-wb-common by kiegroup.
the class ResourceChangeIncrementalBuilderTest method testResourceUpdated.
@Test
public void testResourceUpdated() throws Exception {
final URL resourceUrl = this.getClass().getResource("/BuildChangeListenerRepo/src/main/resources/update.drl");
final org.uberfire.java.nio.file.Path nioResourcePath = fs.getPath(resourceUrl.toURI());
final Path resourcePath = paths.convert(nioResourcePath);
// Force full build before attempting incremental changes
final KieModule module = moduleService.resolveModule(resourcePath);
final BuildResults buildResults = buildService.build(module);
assertNotNull(buildResults);
assertEquals(0, buildResults.getErrorMessages().size());
assertEquals(1, buildResults.getInformationMessages().size());
// Perform incremental build
buildChangeListener.updateResource(resourcePath);
waitForIncrementalBuildResults(buildResultsObserver);
final IncrementalBuildResults incrementalBuildResults = buildResultsObserver.getIncrementalBuildResults();
assertNotNull(incrementalBuildResults);
assertEquals(0, incrementalBuildResults.getAddedMessages().size());
assertEquals(0, incrementalBuildResults.getRemovedMessages().size());
}
Aggregations