use of org.guvnor.common.services.project.builder.model.BuildMessage 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.BuildMessage 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.BuildMessage 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.BuildMessage in project kie-wb-common by kiegroup.
the class ClassVerifierTest method testVerifyClass.
@Test
public void testVerifyClass() {
WhiteList whiteList = new WhiteList();
whiteList.add("org.kie.workbench.common.services.backend.builder");
ClassVerifier classVerifier = new ClassVerifier(kieModuleMetaData, typeSourceResolver);
List<BuildMessage> messages = classVerifier.verify(whiteList);
assertEquals(messages.size(), 1);
assertEquals("Verification of class org.kie.workbench.common.services.backend.builder.SomeClass failed and will not be available for authoring.\n" + "Underlying system error is: The access to the class is not allowed. Please check the necessary external dependencies for this project are configured correctly.", messages.get(0).getText());
}
use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.
the class MessageConverterTest method checkMessageWithoutKieBase.
@Test
public void checkMessageWithoutKieBase() {
final Message m = new MessageImpl(ID, Message.Level.ERROR, FILE, TEXT);
final BuildMessage bm = MessageConverter.convertMessage(m, handles);
assertConversion(bm, () -> TEXT);
}
Aggregations