@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()); }
private void verifyClass(final String packageName, final String className) { try { final Class clazz = kieModuleMetaData.getClass(packageName, className); if (clazz != null) { if (TypeSource.JAVA_DEPENDENCY == typeSourceResolver.getTypeSource(clazz)) { verifyExternalClass(clazz); } } else { logger.warn(MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className))); } } catch (Throwable e) { final String msg = MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className), e.getMessage()); logger.warn(msg); logger.debug("This state is usually encountered when the Project references a class not on the classpath; e.g. in a Maven 'provided' scope or 'optional' dependency.", e); buildMessages.add(makeWarningMessage(msg)); } }
ClassVerifier { private void verifyClass(final String packageName, final String className) { try { final Class clazz = kieModuleMetaData.getClass(packageName, className); if (clazz != null) { if (TypeSource.JAVA_DEPENDENCY == typeSourceResolver.getTypeSource(clazz)) { verifyExternalClass(clazz); } } else { logger.warn(MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className))); } } catch (Throwable e) { final String msg = MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className), e.getMessage()); logger.warn(msg); logger.debug("This state is usually encountered when the Project references a class not on the classpath; e.g. in a Maven 'provided' scope or 'optional' dependency.", e); buildMessages.add(makeWarningMessage(msg)); } } }
ClassVerifier { private void verifyClass(final String packageName, final String className) { try { final Class clazz = kieModuleMetaData.getClass(packageName, className); if (clazz != null) { if (TypeSource.JAVA_DEPENDENCY == typeSourceResolver.getTypeSource(clazz)) { verifyExternalClass(clazz); } } else { logger.warn(MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className))); } } catch (Throwable e) { final String msg = MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className), e.getMessage()); logger.warn(msg); logger.debug("This state is usually encountered when the Project references a class not on the classpath; e.g. in a Maven 'provided' scope or 'optional' dependency.", e); buildMessages.add(makeWarningMessage(msg)); } } ClassVerifier(final KieModuleMetaData kieModuleMetaData,
                         final TypeSourceResolver typeSourceResolver); }
ClassVerifier { private void verifyClass(final String packageName, final String className) { try { final Class clazz = kieModuleMetaData.getClass(packageName, className); if (clazz != null) { if (TypeSource.JAVA_DEPENDENCY == typeSourceResolver.getTypeSource(clazz)) { verifyExternalClass(clazz); } } else { logger.warn(MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className))); } } catch (Throwable e) { final String msg = MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className), e.getMessage()); logger.warn(msg); logger.debug("This state is usually encountered when the Project references a class not on the classpath; e.g. in a Maven 'provided' scope or 'optional' dependency.", e); buildMessages.add(makeWarningMessage(msg)); } } ClassVerifier(final KieModuleMetaData kieModuleMetaData,
                         final TypeSourceResolver typeSourceResolver); List<BuildMessage> verify(WhiteList whiteList); }
ClassVerifier { private void verifyClass(final String packageName, final String className) { try { final Class clazz = kieModuleMetaData.getClass(packageName, className); if (clazz != null) { if (TypeSource.JAVA_DEPENDENCY == typeSourceResolver.getTypeSource(clazz)) { verifyExternalClass(clazz); } } else { logger.warn(MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className))); } } catch (Throwable e) { final String msg = MessageFormat.format(ERROR_EXTERNAL_CLASS_VERIFICATION, toFQCN(packageName, className), e.getMessage()); logger.warn(msg); logger.debug("This state is usually encountered when the Project references a class not on the classpath; e.g. in a Maven 'provided' scope or 'optional' dependency.", e); buildMessages.add(makeWarningMessage(msg)); } } ClassVerifier(final KieModuleMetaData kieModuleMetaData,
                         final TypeSourceResolver typeSourceResolver); List<BuildMessage> verify(WhiteList whiteList);  }