use of org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService in project kie-wb-common by kiegroup.
the class PackageNameWhiteListServiceImplTest method ifWhiteListIsEmptyWhiteListEverything.
@Test
public void ifWhiteListIsEmptyWhiteListEverything() throws Exception {
final PackageNameWhiteListService packageNameWhiteListService = makeService("");
WhiteList filterPackageNames = packageNameWhiteListService.filterPackageNames(mock(KieModule.class), new ArrayList<String>() {
{
add("a");
add("b");
add("c");
}
});
assertEquals(3, filterPackageNames.size());
assertTrue(filterPackageNames.contains("a"));
assertTrue(filterPackageNames.contains("b"));
assertTrue(filterPackageNames.contains("c"));
}
use of org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService in project kie-wb-common by kiegroup.
the class PackageNameWhiteListServiceImplTest method testSave.
@Test
public void testSave() throws Exception {
final PackageNameWhiteListService service = makeService("");
final Path path = mock(Path.class);
final WhiteList whiteList = new WhiteList();
final Metadata metadata = new Metadata();
final String comment = "comment";
service.save(path, whiteList, metadata, comment);
verify(saver).save(path, whiteList, metadata, comment);
}
use of org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService in project kie-wb-common by kiegroup.
the class PackageNameWhiteListServiceImplTest method testUnixEncoding.
@Test
public void testUnixEncoding() {
final PackageNameWhiteListService packageNameWhiteListService = makeService("a.**\nb\n");
final Set<String> results = packageNameWhiteListService.filterPackageNames(mock(KieModule.class), new ArrayList<String>() {
{
add("a");
add("b");
add("a.b");
}
});
assertEquals(3, results.size());
assertContains("a", results);
assertContains("b", results);
assertContains("a.b", results);
}
use of org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService in project kie-wb-common by kiegroup.
the class PackageNameWhiteListServiceImplTest method testWindowsEncoding.
@Test
public void testWindowsEncoding() {
final PackageNameWhiteListService packageNameWhiteListService = makeService("a.**\r\nb\r\n");
final Set<String> results = packageNameWhiteListService.filterPackageNames(mock(KieModule.class), new ArrayList<String>() {
{
add("a");
add("b");
add("a.b");
}
});
assertEquals(3, results.size());
assertContains("a", results);
assertContains("b", results);
assertContains("a.b", results);
}
Aggregations