Search in sources :

Example 1 with PackageNameWhiteListService

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"));
}
Also used : PackageNameWhiteListService(org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService) WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) KieModule(org.kie.workbench.common.services.shared.project.KieModule) Test(org.junit.Test)

Example 2 with PackageNameWhiteListService

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);
}
Also used : Path(org.uberfire.backend.vfs.Path) PackageNameWhiteListService(org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService) WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) Test(org.junit.Test)

Example 3 with PackageNameWhiteListService

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);
}
Also used : PackageNameWhiteListService(org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService) KieModule(org.kie.workbench.common.services.shared.project.KieModule) Test(org.junit.Test)

Example 4 with PackageNameWhiteListService

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);
}
Also used : PackageNameWhiteListService(org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService) KieModule(org.kie.workbench.common.services.shared.project.KieModule) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 PackageNameWhiteListService (org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService)4 KieModule (org.kie.workbench.common.services.shared.project.KieModule)3 WhiteList (org.kie.workbench.common.services.shared.whitelist.WhiteList)2 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)1 Path (org.uberfire.backend.vfs.Path)1