Search in sources :

Example 1 with WhiteList

use of org.kie.workbench.common.services.shared.whitelist.WhiteList 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 WhiteList

use of org.kie.workbench.common.services.shared.whitelist.WhiteList 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 WhiteList

use of org.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.

the class DependenciesItemPresenterTest method testSetupNormal.

@Test
public void testSetupNormal() {
    dependenciesItemPresenter.setup(new NormalEnhancedDependency(mock(Dependency.class), emptySet()), new WhiteList(), mock(DependenciesPresenter.class));
    verify(view).init(any());
    verify(view).setGroupId(any());
    verify(view).setArtifactId(any());
    verify(view).setVersion(any());
    verify(view).setPackagesWhiteListedState(any());
    verify(view).setTransitiveDependency(eq(false));
}
Also used : WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) Test(org.junit.Test)

Example 4 with WhiteList

use of org.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.

the class DependenciesItemPresenterTest method testSetupTransitive.

@Test
public void testSetupTransitive() {
    dependenciesItemPresenter.setup(new TransitiveEnhancedDependency(mock(Dependency.class), emptySet()), new WhiteList(), mock(DependenciesPresenter.class));
    verify(view).init(any());
    verify(view).setGroupId(any());
    verify(view).setArtifactId(any());
    verify(view).setVersion(any());
    verify(view).setPackagesWhiteListedState(any());
    verify(view).setTransitiveDependency(eq(true));
}
Also used : TransitiveEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency) WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) Test(org.junit.Test)

Example 5 with WhiteList

use of org.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.

the class ProjectScreenModelLoaderTest method testWhiteListNoMetadata.

@Test
public void testWhiteListNoMetadata() throws Exception {
    final WhiteList whiteList = new WhiteList();
    testFileSystem.deleteFile(packageNamesWhiteListPath);
    when(whiteListService.load(packageNamesWhiteListPath)).thenReturn(whiteList);
    ProjectScreenModel model = loader.load(pathToPom);
    assertEquals(packageNamesWhiteListPath, model.getPathToWhiteList());
    assertEquals(whiteList, model.getWhiteList());
    assertNotNull(model.getWhiteListMetaData());
}
Also used : WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Aggregations

WhiteList (org.kie.workbench.common.services.shared.whitelist.WhiteList)12 Test (org.junit.Test)11 ProjectScreenModel (org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel)5 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)4 Path (org.uberfire.backend.vfs.Path)3 HashMap (java.util.HashMap)2 PackageNameWhiteListService (org.kie.workbench.common.services.shared.whitelist.PackageNameWhiteListService)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 BuildMessage (org.guvnor.common.services.project.builder.model.BuildMessage)1 NormalEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency)1 TransitiveEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency)1 KieModule (org.kie.workbench.common.services.shared.project.KieModule)1 CommentedOption (org.uberfire.java.nio.base.options.CommentedOption)1