use of org.kie.workbench.common.services.shared.whitelist.WhiteList 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.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.
the class PackageNameWhiteListSaverTest method testSave.
@Test
public void testSave() throws Exception {
final Path path = testFileSystem.createTempFile("whitelist");
final WhiteList whiteList = new WhiteList();
whiteList.add("org.drools");
whiteList.add("org.guvnor");
final Metadata metadata = new Metadata();
final String comment = "comment";
final HashMap<String, Object> attributes = new HashMap<String, Object>();
when(metadataService.setUpAttributes(path, metadata)).thenReturn(attributes);
final CommentedOption commentedOption = mock(CommentedOption.class);
when(commentedOptionFactory.makeCommentedOption("comment")).thenReturn(commentedOption);
saver.save(path, whiteList, metadata, comment);
ArgumentCaptor<String> whiteListTextArgumentCaptor = ArgumentCaptor.forClass(String.class);
verify(ioService).write(any(org.uberfire.java.nio.file.Path.class), whiteListTextArgumentCaptor.capture(), eq(attributes), eq(commentedOption));
final String whiteListAsText = whiteListTextArgumentCaptor.getValue();
assertTrue(whiteListAsText.contains("org.drools"));
assertTrue(whiteListAsText.contains("org.guvnor"));
}
Aggregations